如何获取到文件中返回的数组(如数据库连接配置数据)
01 确定文件的位置.从启动目录名称定义为变量,替换反斜杠,开始拼接
02 导入include不报错,赋值给数组 $config = @include(self::$_file); 有错误继续执行.并隐藏错误
03 数组就得到了,文件中return返回的数据
define('DS', '/');
01 确定文件的位置.从启动目录名称定义为变量,替换反斜杠,开始拼接
02 导入include不报错,赋值给数组 $config = @include(self::$_file); 有错误继续执行.并隐藏错误
03 数组就得到了,文件中return返回的数据
define('DS', '/');
define('CMSTOP_PATH', str_replace('\\', '/', dirname(__FILE__)) . DS)
<?php
return array(
'driver' => 'mysql',
'host' => 'localhost',
'port' => '3306',
'username' => 'root',
'password' => '123',
'dbname' => 'cms',
'prefix' => 'cms_',
'pconnect' => '0',
'charset' => 'utf8',
);