我发现CakePHP 开发人员指南 http://book.cakephp.org/3.0/en/views/helpers/form.html#datetime-options以下提示有关如何在使用时调整字段的顺序date
表单输入。它说
要控制输入的顺序以及输入之间的任何元素/内容,您可以覆盖 dateWidget 模板。
但是,我在任何地方都找不到有关如何更改顺序并在视图中使用它的提示。你能给提示吗?
您可以在初始化 Form helper 时配置 DateWidget 模板
// in MyController.initialize()
$this->loadHelper('Form', [
'dateWidget' => '{{year}}{{month}}{{day}}{{hour}}{{minute}}{{second}}{{meridian}}'
]);
或者您可以使用以下命令覆盖模板templates
表单组件中的函数
$this->Form->templates([
'dateWidget' => '{{year}}{{month}}{{day}}{{hour}}{{minute}}{{second}}{{meridian}}'
]);
@see http://book.cakephp.org/3.0/en/views/helpers/form.html#customizing-the-templates-formhelper-uses http://book.cakephp.org/3.0/en/views/helpers/form.html#customizing-the-templates-formhelper-uses
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)