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条)

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教