php 如何在本地主机上设置CodeIgniter站点?

iecba09b  于 2022-12-02  发布在  PHP
关注(0)|答案(1)|浏览(138)

我是CodeIgniter的新手。我正在尝试在我的本地主机上建立CodeIgniter站点。该站点联机运行良好。以下是我将站点迁移到我的本地主机所采取的步骤。
1.我在application/config/congfig.php中编辑了base_url

$config['base_url']      = "http://localhost/MyProjects/Project/reservation/";

1.我更改了application/config/database.php中的数据库连接设置,以连接到localhost数据库
1.我已经建立了数据库
工作网站URL如下所示:www.example.com/reservation/index.php
我已将站点文件放在本地服务器的MyProjects/Project目录中。我正在尝试访问

'http://localhost/MyProjects/Project/reservation/index.php'

但它返回空白页。(空body元素:)
下面是应用程序\配置\路由. php的内容

$route['default_controller'] = "admin";
$route['scaffolding_trigger'] = "";  

require_once BASEPATH.'database/DB'.EXT;

$db_obj = DB(); 
$new_branches = $db_obj->get('table_branches');
$new_branches = $new_branches->result();

foreach($new_branches as $branch){
   $route[trim($branch->url)]   = "reserve/index/".$branch->url;
   $route[trim($branch->url).'/']   = "reserve/index/".$branch->url;
   $route[trim($branch->url).'/admin']  = "admin";

}

有人能帮我吗?

dxxyhpgq

dxxyhpgq1#

路由文件中的第3行有错误:

$route['default_controller'] = "admin";
$route['scaffolding_trigger'] = "";  
==> employee_punchin|admin)\S*'] = "reserve/routing/$1";

应该修复它:

$route['(employee_punchin|admin)\S*'] = "reserve/routing/$1";

在index.php文件中,将ENVIRONMENT更改为development以显示错误:

define('ENVIRONMENT', 'development');

相关问题