如何在CakePHP3中转换下面的代码? 头衔

如何在CakePHP3中转换下面的代码? 头衔,cakephp,cakephp-3.0,Cakephp,Cakephp 3.0,我的add.ctp文件中有这种类型的代码,我不知道如何将其转换为类似的代码 <div class="form-group"> <label for="inputEmail" class="col-lg-2 control-label">Title</label> <div class="col-lg-10"> <input type="text" style="width: 45%;" class="f

我的add.ctp文件中有这种类型的代码,我不知道如何将其转换为类似的代码

<div class="form-group">
      <label for="inputEmail" class="col-lg-2 control-label">Title</label>
      <div class="col-lg-10">
        <input type="text" style="width: 45%;" class="form-control" id="titleId" name="title" placeholder="Title">
      </div>
</div>

您必须使用Form helper而不是CakePHP Html helper。Form helper帮助您创建表单字段并帮助验证表单。但是Html助手可以帮助您创建类似Html的Html来显示图像。我们开始

<? echo $this->Html->input('title',['class'=>'']);
我建议您访问此链接,深入查看文档:)

$this->Form->input('title', [
    'label' => [
        'text' => 'Title', 
        'class' => 'col-lg-2'
    ],
    'style' => [
        'width: 45%;'
    ]
]);