gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 23:17:27 25 4
gpt4 key购买 nike

我是 CodeIgniter 的新手。我正在尝试在本地主机上设置 CodeIgniter 站点。该网站在线运行良好。以下是我将网站迁移到本地主机所采取的步骤。

  1. 编辑了 application/config/congfig.php 中的 base_url

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

  3. 已设置数据库

工作站点 URL 如下所示: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";

}

有人可以帮我解决这个问题吗?

最佳答案

您的路由文件第 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');

关于php - 如何在本地主机上设置 CodeIgniter 站点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27648426/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com