此值$enquiry['Enquiry']['read']
返回1,但在视图文件中,状态为no ..i已打印显示的值1 ..
echo $this->Html->link($this->Layout->boolYesNo($enquiry['Enquiry']['read']), array('controller' => 'enquiries', 'action' => 'toggle_status', $enquiry['Enquiry']['id']), array('escape' => false));
答案 0 :(得分:1)
$answer = ($enquiry['Enquiry']['read'] == 0) ? 'No' : 'Yes';
echo $this->Html->link($anwer, array('controller' => 'enquiries', 'action' => 'toggle_status', $enquiry['Enquiry']['id']), array('escape' => false));
//OR
$current_enquiry = ($enquiry['Enquiry']['read'] == 0) ? false : true;
echo $this->Html->link($this->Layout->boolYesNo($current), array('controller' => 'enquiries', 'action' => 'toggle_status', $enquiry['Enquiry']['id']), array('escape' => false));
// it does say boolYesNo, so my guess is that it's expecting a bool (not int)