如何在cakephp 3.x复选框中编写php变量?

时间:2017-07-22 11:46:16

标签: php cakephp

<?php


if ($checkbox == 1) {
    $checked = 'checked';
} {
    $checked = '';
}
echo $this->Form->input('Off Line Quotes', array(
    'type' => 'checkbox',
    'checked' => $checked,
    'class' => 'inline',
    'id' => 'editcheckbox_quotes',
    'format' => array(
        'before',
        'input',
        'between',
        'label',
        'after',
        'error'
    )
));
?>

1 个答案:

答案 0 :(得分:3)

尝试将其他内容放在{$ checked =''}

前面