【发布时间】:2014-02-10 11:05:28
【问题描述】:
默认情况下,cakephp 将在 find() 上返回空数组。
但是如何将其设置为显示为空白数组。
例如:
$customer = $this->Transaction->Customer->find(--conditions to return 0 result.--)
我希望它像这样显示为 空白数组。
array('Customer' => array('customer_id'=>null, 'name'=>null, 'lastname'=>null))
不只是空的一个像
array() 或 null
因为我总是看到错误显示$customer['Customer']['name'] 是未定义的索引。而且我不喜欢每次都使用isset() 或is_null() 进行检查。
【问题讨论】: