Laravel 4 控制器和路由不';t生成index.php I';m使用laravel 4.1

Laravel 4 控制器和路由不';t生成index.php I';m使用laravel 4.1,laravel-4,Laravel 4,我是拉威尔的新手。我有一个关于支持和观点的问题。我正在学习一个教程。但是教程的输出和我的输出不一样。 当我在地址栏localhost/laravel/2nd_project/public/authors插入这个时,我并没有生成index.php,它应该像教程一样有一个输出 下面是controllers/authors.php <?php class Authors_Controller extends Base_Controller{ public $restful = t

我是拉威尔的新手。我有一个关于支持和观点的问题。我正在学习一个教程。但是教程的输出和我的输出不一样。 当我在地址栏localhost/laravel/2nd_project/public/authors插入这个时,我并没有生成index.php,它应该像教程一样有一个输出

下面是controllers/authors.php

<?php
  class Authors_Controller extends Base_Controller{
      public $restful = true;

  public function get_index(){
      return View::make('authors.index');
   }
}

看起来您正在学习基于Laravel 3的教程。在《拉维4》中,情况发生了变化。在laravel 4中,控制器名称必须遵循模式
SomethingController
,因此控制器的文件名必须是
AuthorsController.php
,类名muse必须是
AuthorsController

因此,在controllers目录中,您将有一个名为
AuthorsController.php
的文件,类似于:

<?php
  class AuthorsController extends BaseController {
    public function getIndex()
    {
        return View::make('authors.index');
    }
}

如果您想在Laravel 4中使用RESTful控制器,可以在这里的官方文档中阅读更多信息:

这是views/authors/index.php Hi User!!你得到了什么?你的Laravel安装成功了吗?你看到这个了吗?是的,我已经看到了这一点,而且它是成功的,实际上我已经迁移并使用模式创建了一个数据库。但是您是否收到任何错误?你看到了什么?“我没有生成index.php”是什么意思?索引php已经存在,您不必生成它。如果您遵循教程,为什么您的代码是Laravel 3风格的?感谢您提供的信息,但它仍然存在相同的问题。404未找到您是否在Apache中启用了
mod_rewrite
插件?否,我正在使用wamp服务器,在哪里可以找到它?左键单击系统托盘中的wamp图标。转到
Apache
>
Apache模块
,然后单击
rewrite模块
进行检查。您可能需要向下滚动列表以查看
重写模块
。然后等待服务器重新启动。
<h1>Hi User!!</h1>
<?php
  class AuthorsController extends BaseController {
    public function getIndex()
    {
        return View::make('authors.index');
    }
}
Route::get('authors', array('uses'=>'AuthorsController@getIndex'));