CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 标识和商标
  • 商业解决方案
  • 商品
  • 公路旅行
  • 团队
  • 社区
    • 社区
    • 参与进来
    • 问题 (Github)
    • 面包店
    • 特色资源
    • 培训
    • 聚会
    • 我的CakePHP
    • CakeFest
    • 通讯
    • LinkedIn
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • 帮助和支持
    • 论坛
    • Stack Overflow
    • IRC
    • Slack
    • 付费支持
CakePHP

C CakePHP 5.1 Chiffon API

  • 项目
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • 队列
  • 版本
    • 5.1
      • 5.1
      • 5.0
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

命名空间

  • 全局
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget

类 FileWidget

用于生成文件上传控件的输入小部件类。

此类通常由 Cake\View\Helper\FormHelper 内部使用,但可以用于生成独立的文件上传控件。

命名空间: Cake\View\Widget

属性摘要

  • $_templates protected
    Cake\View\StringTemplate

    StringTemplate 实例。

  • $defaults protected
    array<string, mixed>

    数据默认值。

方法摘要

  • __construct() public

    构造函数。

  • mergeDefaults() protected

    将默认值与提供的 data 合并。

  • render() public

    渲染文件上传表单小部件。

  • secureFields() public

    返回需要为该小部件保护的字段列表。

  • setMaxLength() protected

    如果适用,设置“maxlength”属性的值。

  • setRequired() protected

    如果适用,设置“required”属性的值。

  • setStep() protected

    如果适用,设置“step”属性的值。

方法详情

__construct() ¶ public

__construct(Cake\View\StringTemplate $templates)

构造函数。

参数
Cake\View\StringTemplate $templates

模板列表。

mergeDefaults() ¶ protected

mergeDefaults(array<string, mixed> $data, Cake\View\Form\ContextInterface $context): array<string, mixed>

将默认值与提供的 data 合并。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

返回
array<string, mixed>

render() ¶ public

render(array<string, mixed> $data, Cake\View\Form\ContextInterface $context): string

渲染文件上传表单小部件。

数据支持以下键

  • name - 设置输入名称。
  • escape - 设置为 false 以禁用 HTML 转义。

所有其他键将被转换为 HTML 属性。与其他输入对象不同,val 属性将被专门忽略。

参数
array<string, mixed> $data

用于构建文件输入的数据。

Cake\View\Form\ContextInterface $context

当前表单上下文。

返回
string

secureFields() ¶ public

secureFields(array<string, mixed> $data): list<string>

返回需要为该小部件保护的字段列表。

参数
array<string, mixed> $data
返回
list<string>

setMaxLength() ¶ protected

setMaxLength(array<string, mixed> $data, Cake\View\Form\ContextInterface $context, string $fieldName): array<string, mixed>

如果适用,设置“maxlength”属性的值。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

string $fieldName

字段名称。

返回
array<string, mixed>

setRequired() ¶ protected

setRequired(array<string, mixed> $data, Cake\View\Form\ContextInterface $context, string $fieldName): array<string, mixed>

如果适用,设置“required”属性的值。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

string $fieldName

字段名称。

返回
array<string, mixed>

setStep() ¶ protected

setStep(array<string, mixed> $data, Cake\View\Form\ContextInterface $context, string $fieldName): array<string, mixed>

如果适用,设置“step”属性的值。

参数
array<string, mixed> $data

数据数组

Cake\View\Form\ContextInterface $context

上下文实例。

string $fieldName

字段名称。

返回
array<string, mixed>

属性详情

$_templates ¶ protected

StringTemplate 实例。

类型
Cake\View\StringTemplate

$defaults ¶ protected

数据默认值。

类型
array<string, mixed>
OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 标识和商标
  • 社区
  • 参与进来
  • 问题 (Github)
  • 面包店
  • 特色资源
  • 培训
  • 聚会
  • 我的CakePHP
  • CakeFest
  • 通讯
  • LinkedIn
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • 帮助和支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成