【发布时间】:2013-03-29 00:18:39
【问题描述】:
我正在关注锂的快速入门指南:http://li3.me/docs/manual/quickstart
我在 /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
会显示 Lithium 自带的默认主页。
所以我尝试通过将此行添加到我的 /var/www/my_app/config/routes.php 文件来解决问题:
Router::connect('/posts', 'Posts::index');
但我得到同样的 Not Found 错误?
【问题讨论】: