我目前春耕我的方式,通過IBM's tutorial on CakePHP我可以在類變量中添加沒有賦值的PHP數組鍵嗎?
有一次,我碰到這個代碼片段:
<?php
class Dealer extends AppModel {
var $name = 'Dealer';
var $hasMany = array (
'Product' => array(
'className' => 'Product',
'conditions'=>, // is this allowed?
'order'=>, // same thing here
'foreignKey'=>'dealer_id'
)
);
}
?>
當我運行它,我收到以下錯誤消息:「解析錯誤:語法錯誤,在第7行中的/Applications/MAMP/htdocs/cakephp/app/models/product.php中出現意外的','
我是PHP的n00b,所以我的問題是:是否允許創建一個數組沒有賦值的鍵?有沒有人玩過這個嘖嘖,知道什麼是?