dongqin8652 2014-05-06 19:33
浏览 38
已采纳

Laravel 4 Route ::资源问题

I'm new to Laravel, I have a route in my routes.php file like this:

    <?php
Route::resource('search', 'SearchController');                
?>

and I have the controller app/controllers/SearchController.php that looks like this:

<?php

    class SearchController extends \BaseController {

        protected $layout = 'layouts.master';
        public function create() {}

        public function store(){}

        public function index(){
            return View::make('hello');
        }
    }
    ?>

I previously had a controller with unrestful methods name SearchController. I renamed that one to OldSearchController and updated the routes.

and a file hello.php in app/views.

but, whenever I try to access the page via http://localhost/search, I get the following error:

BadMethodCallException 
Method [index] does not exist.

what else needs to be done?

  • 写回答

2条回答 默认 最新

  • dpcj32769 2014-05-06 21:04
    关注

    As I said in the comments, the following command did the trick:

    php artisan dump-autoload
    

    Probably something happened during the installation.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 Hyper-v虚拟机相关问题,求解答。
  • ¥15 TSM320F2808PZA芯片 Bootloader
  • ¥45 谷歌浏览器出现开发者工具无法显示已创建的,但您可以调试已部署的代码。 状态代码 404, net::ERR HTTP RESPONSE CODE FAILURE
  • ¥15 如何解决蓝牙通话音频突发失真问题
  • ¥15 安装opengauss数据库报错
  • ¥15 【急】在线问答CNC雕刻机的电子电路与编程
  • ¥60 在mc68335芯片上移植ucos ii 的成功工程文件
  • ¥15 笔记本外接显示器正常,但是笔记本屏幕黑屏
  • ¥15 Python pandas
  • ¥15 蓝牙硬件,可以用哪几种方法控制手机点击和滑动