【问题标题】:Getting Codeigniter to work on localhost with xampp使用 xampp 让 Codeigniter 在 localhost 上工作
【发布时间】:2012-05-08 14:02:05
【问题描述】:

我在 Windows 7 机器上安装了 Netbeans、Codeigniter 和 xampp,我只是想调用一个简单的对象来显示 hello world。

在用完许多教程后,我不断收到 Object not found 错误。当我运行我的脚本时,它使用以下网址

http://localhost/project1/CodeIgniter_2.1.0/application/controllers/hello.php

所以当我从浏览器调用 localhost/xampp 时,xampp 工作正常,虽然我不确定还需要配置什么。

虽然目前我的config.php 设置如下$config['base_url'] = '';,但我尝试了许多不同的基本网址

我是一个新手,只是想把东西设置好,这样我就可以开始做项目了,但好几天都过不去。

【问题讨论】:

标签: codeigniter xampp


【解决方案1】:

CodeIgniter URL 不是这样工作的。应该是:

http://path/to/codeigniter/index.php/<controller>/<function>/<param>

所以,在你的情况下,它应该是:

http://localhost/project1/CodeIgniter_2.1.0/index.php/hello

$config['base_url'] 应该设置为index.php,所以应该是:

$config['base_url'] = 'http://localhost/project1/CodeIgniter_2.1.0/index.php';

文档:http://codeigniter.com/user_guide/general/urls.html

【讨论】:

  • 设置“index.php”对我有帮助!谢谢!!
猜你喜欢
  • 1970-01-01
  • 2016-03-24
  • 2015-04-07
  • 2013-07-07
  • 1970-01-01
  • 1970-01-01
  • 2021-06-11
  • 2016-05-12
  • 1970-01-01
相关资源
最近更新 更多