3

我在 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'] = '';

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

4

1 回答 1

14

这不是 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

于 2012-04-27T21:27:26.807 回答