我下面的快速入門指南,鋰:http://li3.me/docs/manual/quickstart鋰PHP的路線不工作
我創造了我的帖子模型/var/www/my_app/app/models/Posts.php
<?php
namespace app\models;
class Posts extends \lithium\data\Model {
}
?>
我創造了我的帖子控制器在/var/www/my_app/app/controllers/PostsController.php
<?php
namespace app\controllers;
class PostsController extends \lithium\action\Controller {
public function index() {
return array('foo' => 'bar', 'title' => 'Posts');
}
}
?>
我創造了我的/var/www/my_app/app/views/posts/index.html查看。 php
Lithium is less dense than <?=$foo;?>ium.
快速入門指南,然後說,我應該能夠去
http://localhost/my_app/posts
查看我的帖子索引頁,但我得到一個
Not Found
The requested URL /my_app/posts was not found on this server.
但是,如果我去只是
http://localhost/my_app
Lith自帶的默認主頁顯示ium。
所以,我想通過加入這一行我/var/www/my_app/config/routes.php文件解決了這個問題:
Router::connect('/posts', 'Posts::index');
但我得到同樣未找到錯誤?
我運行這個命令啓用mod_rewrite:「sudo a2enmod rewrite」,並修改了「/ etc/apache2/sites-available/default」,並將AllowOverride設置爲「All」。 – 2013-04-07 16:39:47
唉!不能相信我忘了檢查我的虛擬主機指令。感謝提醒,它做到了! :) – 2013-09-07 21:20:13