0
這是代碼:公告:未定義的索引:在類 - >陣列
class app {
public $conf = array();
public function init(){
global $conf;
$conf['theme'] = 'default';
$conf['favicon'] = 'favicon.ico';
}
public function site_title(){
return 'title';
}
}
$app = new app;
$app->init();
//output
echo $app->conf['theme'];
而且我得到這個錯誤:
Notice: Undefined index: theme in C:\xampp\htdocs\...\trunk\test.php on line 21
我在哪裏出了問題,並沒有任何簡單的方法獲得相同的結果?