1

我最近将我的 codeigniter 版本从 2.2.0 升级到了 3.0.0 版本,我遇到了一些问题。我在 config/constants.php 中有一段代码,它从数据库中获取配置数据并将值设置为常量。代码如下:

require_once ( BASEPATH. 'database/DB'. EXT );
$db =& DB();
$query = $db->get_where ('settings_table', array('id' => '1'));
$row = $query->row_array();
define ("LOGO",$row["logo"]);

这段代码运行良好,直到我升级了 codeigniter,现在我收到了这个错误:注意:在 file-path/config/constants.php 中使用未定义的常量“EXT”

这可能是什么原因,我该如何解决这个问题?

4

1 回答 1

1

在 CI 3.0 中,EXT 常量未在 index.php 中定义

CI 2.2.2 示例

// The PHP file extension
// this global constant is deprecated.
define('EXT', '.php');

要使其与您的脚本一起使用,只需将其更改为:

require_once ( BASEPATH. 'database/DB.php'); 
//or whatever the extension is for that file

我希望这能解决你的问题。

于 2015-07-09T10:00:56.697 回答