如何在localhost上设置CodeIgniter站点?

时间:2014-12-25 15:15:25

标签: php mysql codeigniter localhost

我是CodeIgniter的新手。我正在尝试在本地主机上设置CodeIgniter站点。该网站在线工作正常。以下是我将网站迁移到本地主机的步骤。

  1. 编辑了application / config / congfig.php

    中的base_url
    $config['base_url']      = "http://localhost/MyProjects/Project/reservation/";
  2. 更改了application / config / database.php中的数据库连接设置以连接到localhost数据库

  3. 已设置数据库
  4. 工作网站网址如下所示:www.example.com/reservation/index.php

    我已将站点文件放在本地服务器的MyProjects / Project目录中。 我正在尝试访问

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

    但它返回空白页面。 (空体元素:)

    这是application \ config \ routes.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";
    
    }
    

    任何人都可以帮我这个吗?

1 个答案:

答案 0 :(得分:0)

第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文件中

,将环境更改为开发以显示错误:

define('ENVIRONMENT', 'development');