【问题标题】:Lithium/Apache on Mac : can't access to the viewMac 上的 Lithium/Apache:无法访问视图
【发布时间】:2013-08-02 05:41:45
【问题描述】:

我已经安装了 Lithium 并在 Mac 上进行了测试。

我无法访问我定义的视图。我只能访问索引文件。

我的简单项目是 firstLithium。我将它设置在 /Library/Webserver/Documents 在这个项目中,我创建了 1 个名为帖子的视图。下面是我的 MVC 的内容。

models/Posts.php

    <?php
    namespace app\models;
    class Posts extends \lithium\data\Model {
    }
    ?>

views/posts/index.html.php

锂的密度低于 ium。

控制器/PostsController.php

    <?php
    namespace app\controllers;
    class PostsController extends \lithium\action\Controller {
        public function index() {
            return array('foo' => 'bar', 'title' => 'Posts');        
        }   
          public function add() {
        }
    }
    ?>

来自网络浏览器:

  • localhost/firstLithium:效果很好

  • localhost/firstLithium/posts:它不起作用

未找到 在此服务器上找不到请求的 URL /firstLithium/posts。 相同的示例可以在 ubuntu 上运行,但不能在 Mac 上运行。我可以帮你在 Mac 上运行它吗?提前谢谢你。

【问题讨论】:

    标签: lithium


    【解决方案1】:

    看起来肯定是您的网络服务器设置有问题,而不是 Lithium。 试试这个guide,如果问题仍然存在,请随时在#li3 IRC 频道联系我。

    【讨论】:

      【解决方案2】:

      另外,请确保您为 Apache 启用了 mod_rewrite。对于 Mac,我不确定该命令是什么,但在 Linux 上,它是:

      sudo a2enmod rewrite
      

      【讨论】:

        猜你喜欢
        • 2013-10-02
        • 1970-01-01
        • 2012-01-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-05-24
        • 1970-01-01
        • 2019-02-22
        相关资源
        最近更新 更多