2017-09-16 23 views
0
<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> 

我有這種類型的代碼在我add.ctp文件,我不知道如何將它轉換成像如何在CakePHP 3中轉換下面的代碼?

<? echo $this->Html->input('title',['class'=>'']); 

回答

1

你必須使用的,而不是CakePHP的HTML輔助形式幫手。表單助手可幫助您創建表單字段以及幫助驗證表單。但Html幫助程序可幫助您創建Html,如圖像顯示一樣。在這裏,我們去

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

我想提醒你去這個鏈接,對文檔從深層次看:)

Here is the Form helper of CakePHP 3

Here is the Html helper of CakePHP 3

相關問題