Codeigniter 3x中的路由工作不正常


Routing is not working properly in Codeigniter 3x

我在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设置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

找不到您的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');

显然,消息是关于文件的

/home/content/02/8784902/html/example/system/database/DBEXT

在您的系统中找不到。您应该检查您的文件是否存在于该路径上,然后更改路径或在那里添加文件。