环境:WIN2003,FASTCGI
运行PHP代码出现如下错误:PHP Notice: Use of undefined constant kind - assumed 'kind' in D:\web\abcd.net\mart\conf\db_info.php on line 2
PHP Notice: Use of undefined constant host - assumed 'host' in D:\web\abcd.net\mart\conf\db_info.php on line 3
PHP Notice: Use of undefined constant name - assumed 'name' in D:\web\abcd.net\mart\conf\db_info.php on line 4PHP.INI文件里改成
error_reporting = E_ALL & ~E_NOTICE
的话,显示不了页面。
请问这个怎么解决?谢谢,
运行PHP代码出现如下错误:PHP Notice: Use of undefined constant kind - assumed 'kind' in D:\web\abcd.net\mart\conf\db_info.php on line 2
PHP Notice: Use of undefined constant host - assumed 'host' in D:\web\abcd.net\mart\conf\db_info.php on line 3
PHP Notice: Use of undefined constant name - assumed 'name' in D:\web\abcd.net\mart\conf\db_info.php on line 4PHP.INI文件里改成
error_reporting = E_ALL & ~E_NOTICE
的话,显示不了页面。
请问这个怎么解决?谢谢,
$DB[kind] = "mysql";
$DB[host] = "localhost";
$DB[name] = "test";
$DB[user] = "root";
$DB[pass] = "123456";
?>
第二部:将] =替换为'] =
php.ini
里的开关解决这个问题呢?
不加引号的话PHP引擎会把键值认为是常量,也就是你上面的报错内容(未定义的常量),标准写法推荐用引号。