1
創建與表中的字段標籤PHP從型號
echo $this->Form->create('Street');
echo $this->Form->input('street', array('empty' => '-- select --', 'label' => '???'));
DB
ID | Street | Description
-----------------------
1 | Foo | Street 1 description
2 | Bar | Street 2 description
3 | FooFoo | Street 3 description
我要創建標籤,如:
Foo - Street 1 description
像:
echo $this->Form->input('street', array('empty' => '-- select --', 'label' => 'Street.street - Street.description'));
我如何使用CakePHP Form Helper生成這個?謝謝!
您好! '$ street ['Street'] ['description']'因爲數組索引而無法工作,如果我有多條街道。 –
遍歷視圖中的數組以獲得正確的索引... –