按這樣修改就可以了:
public目錄下的自定義配置檔案siteconfig.inc.php,用如下程式碼:
$siteconfig = require "__PUBLIC__/siteconfig.inc.php";
$config = array(
//"配置項"=>"配置值"
// 新增資料庫配置資訊
"USERNAME" => "admin",
"DB_TYPE" => "mysql", // 資料庫型別
"DB_HOST" => "127.0.0.1", // 伺服器地址
"DB_NAME" => "detectinfo", // 資料庫名
//"DB_USER" => "root", // 使用者名稱
//"DB_PWD" => "", // 密碼
"DB_PORT" => "", // 埠
"DB_PREFIX" => "", // 資料庫表字首
);
return array_merge($config,$siteconfig);
?>
複製程式碼
但是require函式會報錯
ERROR:require(): Failed opening required "__PUBLIC__/siteconfig.inc.php" (include_path=".;C:\php\pear;C:\wamp\www\ThinkPHP/Extend/Vendor/") in C:\wamp\www\PluginDetect\Conf\config.php on line 2
按這樣修改就可以了:
public目錄下的自定義配置檔案siteconfig.inc.php,用如下程式碼:
$siteconfig = require "__PUBLIC__/siteconfig.inc.php";
$config = array(
//"配置項"=>"配置值"
// 新增資料庫配置資訊
"USERNAME" => "admin",
"DB_TYPE" => "mysql", // 資料庫型別
"DB_HOST" => "127.0.0.1", // 伺服器地址
"DB_NAME" => "detectinfo", // 資料庫名
//"DB_USER" => "root", // 使用者名稱
//"DB_PWD" => "", // 密碼
"DB_PORT" => "", // 埠
"DB_PREFIX" => "", // 資料庫表字首
);
return array_merge($config,$siteconfig);
?>
複製程式碼
但是require函式會報錯
ERROR:require(): Failed opening required "__PUBLIC__/siteconfig.inc.php" (include_path=".;C:\php\pear;C:\wamp\www\ThinkPHP/Extend/Vendor/") in C:\wamp\www\PluginDetect\Conf\config.php on line 2