【发布时间】:2017-09-01 00:51:45
【问题描述】:
我刚开始使用 CodeIgniter,却被文档中的 hello world 代码卡住了。每次我在 url 栏中输入博客控制器的名称并按 Enter 时,都会出现以下错误:
404 Error Page Not Found!
localhost/php/CodeIgniter/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
route.php
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
config.php
$config['base_url'] = 'http://localhost/php/CodeIgniter/';
$config['index_page'] = 'index.php';
controllers/Blog.php
<?php
class Blog extends CI_Controller {
public function index()
{
echo 'Hello World!';
}
}
我该如何解决这个问题?
【问题讨论】:
标签: php codeigniter