2017-08-11 25 views
0
$policyYear = 

Array 
(
    [1] => 1 Year 
    [2] => 2 Year 
    [3] => 3 Year 
) 




<div> 
<?php 
$options = $policyYear; 
$attributes = array('legend' => false); 
echo $this->Form->radio('policy_year', $options, $attributes); 
?> 
</div> 

這是我的代碼,它給出了三個單選按鈕,其值爲'1年','2年','3年'。但我想爲初始值設置爲'1年'。我怎樣才能做到這一點 ?。我是cakephp中的新人。我知道它在覈心PHP。請幫忙。如何在cakephp 3.x中選擇第一個收音機

回答

0

更新您的$attributes和增值

$attributes = array('legend' => false,'value' => $foo);