【问题标题】:Run webpage on localhost在 localhost 上运行网页
【发布时间】:2017-02-17 07:04:43
【问题描述】:

我正在开发一个具有 MVC 架构并使用 codeigniter 框架的项目。当我尝试按以下方式运行文件时,我不断收到错误。

http://localhost:9080/internship-management/sourcecode/codeigniter/index.php/vacancyManagement

我已经在config目录下的config.php文件中设置了base_url如下

*/
$config['base_url'] = 'http://localhost:9080/internship-management/sourcecode/codeigniter/';  
/*

我的项目 Internship-Management 在 wamp 的 www 下的 C 盘内。

C:\wamp\www\Internship-Management\SourceCode\CodeIgniter

控制器的项目结构如下

尝试使用开头指定的路径运行控制器后(打开 wamp 服务器后),我收到此错误

在这方面的任何帮助都将受到高度赞赏,因为我已经为此思考了好几个小时了,我知道这是微不足道的

【问题讨论】:

  • @Anish 我收到了这个请求的 url not found 错误。 The requested URL /Internship-Management/SourceCode/CodeIgnite‌​r/index.php/vacancyManagement was not found on this server.
  • 您的控制器文件夹中有一个名为vacancyManagement.php 的文件吗?似乎这是主页控制器,服务器找不到它。另外,您的路径中有.htaccess 文件吗?
  • @AhmedEssam 我在控制器下有 vacancyManagement,如上图所示(项目结构)
  • 你在使用 CodeIgniter 3 吗?如果是这样,那么您需要将文件的第一个字母大写。此要求已在 CodeIgnier 3 codeigniter.com/userguide3/installation/… 中添加

标签: php codeigniter url model-view-controller localhost


【解决方案1】:

这个问题是由缺少一些 CodeIgniter 系统文件引起的 在 CodeIgniter 目录中,需要维护以下结构

CodeIgniter

   - .idea(directory)
   - application(directory)
   - system(directory)
   - user_guide(directory)
   - .gitignore (text file)
   - composer.json (JSON file)
   - contributing.md (MD file)
   - index.php
   - license.txt

【讨论】:

  • 只需要应用程序、系统、index.php。其他的都应该/可以删除/省略
  • @AbdullaNilam 感谢您的反馈。我会保留这些文件,以防万一
猜你喜欢
  • 2018-11-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-27
  • 1970-01-01
  • 2021-07-02
相关资源
最近更新 更多