简体   繁体   English

Codeigniter升级问题

[英]Codeigniter upgrade issues

I recently upgraded my version of codeigniter from 2.2.0 to version 3.0.0 and I am experiencing some issues. 我最近将我的codeigniter版本从2.2.0升级到了3.0.0版本,并且遇到了一些问题。 I have a piece of code in config/constants.php which fetches configuration data from the database and sets the values to the constants. 我在config / constants.php中有一段代码,该代码从数据库中获取配置数据并将值设置为常量。 The code is as below: 代码如下:

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"]);

This code was working well until I upgraded codeigniter and now i get this error: Notice: Use of undefined constant 'EXT' in file-path/config/constants.php . 在我升级codeigniter之前,这段代码一直运行良好,现在出现此错误: 注意:在file-path / config / constants.php中使用了未定义的常量'EXT'

What could be the reason for it and how do I resolve the issue? 原因可能是什么?如何解决该问题?

In CI 3.0 the EXT constant is not defined in the index.php 在CI 3.0中,EXT常量未在index.php中定义

CI 2.2.2 example CI 2.2.2示例

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

To get this to work with your script just change it to: 要使其与脚本一起使用,只需将其更改为:

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

I hope this solves your problem. 我希望这能解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM