require_once($_SERVER["DOCUMENT_ROOT"] . 'config.php');
class stuff{
public $dhb;
public function __construct(){
$dbh = new PDO('mysql:host=' . $database['host'] . ';dbname=' . $database['dbname'] . '', $database['user'], $database['password']);
}
}
訪問陣列的配置文件在上面的例子中我得到這個錯誤:如何從一個類
Notice: Undefined variable: database in C:\wamp\www\career\inc\controller.php on line 11
?我怎樣才能訪問陣列我有config.php
?它包含$database
陣列。
感謝。是的,這是一個假的名字;) – 2013-02-20 09:52:44