我正在使用FX.php和Codeigniter来访问Filemaker DB。库和配置文件在config/autoload.php中自动加载。
这个设置在我的开发机器(OS,PHP5.3.14)上工作得很好。但是,当我在我们的开发服务器(Ubuntu Precise,PHP 5.3.10)上运行该项目时,它无法工作。似乎没有将配置参数传递到库有问题。我收到以下错误消息:
Severity: Notice
Message: Undefined index: dataServer
Filename: libraries/CIFX.php
Line Number: 9
Severity: Notice
Message: Undefined index: dataPort
Filename: libraries/CIFX.php
Line Number: 9
Severity: Notice
Message: Undefined index: dataType
Filename: libraries/CIFX.php
Line Number: 9
Severity: Notice
Message: Undefined index: dataURLType
Filename: libraries/CIFX.php
Line Number: 9我的libraries/CIFX.php文件如下所示:
require('FX.php');
class CIFX extends FX {
function __construct ($params = array())
{
parent::__construct($params['dataServer'], $params['dataPort'], $params['dataType'], $params['dataURLType']);
}
}
?>我的config/CIFX.php文件如下所示:
$config['dataServer'] = '192.168.1.10';
$config['dataPort'] = '80';
$config['dataType'] = 'FMPro7';
$config['dataURLType'] = '';
$config['dbuser'] = '';
$config['dbpassword'] = '';根据Codeigniter manual的说法,这应该是可行的。
任何帮助都非常感谢!
发布于 2013-01-07 19:43:24
初始化类时需要传递参数
$params = array(
'dataServer' => $this->config->item('dataServer');,
'dataPort' => $this->config->item('dataPort');
);
$this->load->library('CIFX ', $params);https://stackoverflow.com/questions/14193807
复制相似问题