我正在使用表单助手输入日期选择如下
echo $this->Form->date('date_from', [
'empty' => [
'year' => 'Choose Year',
'month' => 'Choose Month',
'day' => 'Choose Date'
],
'label' => 'Date From'
]);
但这仅显示选择字段而不是标签日期从
我正在使用表单助手输入日期选择如下
echo $this->Form->date('date_from', [
'empty' => [
'year' => 'Choose Year',
'month' => 'Choose Month',
'day' => 'Choose Date'
],
'label' => 'Date From'
]);
但这仅显示选择字段而不是标签日期从
看起来 CakePHP3 表单助手date
不支持label
作为参数。
但这将生成与您想要的完全相同的标签:
<?php
echo $this->Form->label('Date From');
echo $this->Form->date('date_from', [
'empty' => [
'year' => 'Choose Year',
'month' => 'Choose Month',
'day' => 'Choose Date'
],
]);
?>
请参阅此处:在 CakePHP3 表单助手中创建标签。