我在ci的旧设置中使用此代码并且它正在运行
在routes.php中
require_once( BASEPATH .'database/DB'.'EXT' );
$db =& DB();
$query = $db->get('manya_webpage');
$result = $query->result();
foreach( $result as $row ){
$route[ $row->slug ] = 'page/call/'.$row->slug;
}
但它在ci setup 3x
中无效ERROR
A PHP Error was encountered
Severity: Warning
Message: require_once(/home/content/02/8784902/html/example/system/database/DBEXT) [function.require-once]: failed to open stream: No such file or directory
Filename: config/routes.php
答案 0 :(得分:1)
找不到您的DBEXT文件。尝试将代码更改为:
include(APPPATH.'config/database'.EXT);
$db =& DB();
$query = $db->get('manya_webpage');
$result = $query->result();
foreach( $result as $row ){
$route[ $row->slug ] = 'page/call/'.$row->slug;
}
还要确保在index.php中包含
/ The PHP file extension
// this global constant is deprecated.
define('EXT', '.php');
答案 1 :(得分:0)
显然该消息是关于文件的
/home/content/02/8784902/html/example/system/database/DBEXT
在您的系统上找不到。您应该检查您的文件是否存在于此路径上,并更改路径或在那里添加文件。