如何在laravel中调用特定的控制器操作

时间:2015-05-09 16:49:18

标签: php laravel laravel-5 laravel-routing

我对Laravel很新。我创建了新的Controller

class ContactController extends Controller {

    public function index(){
        die("X");
    }
}

routes.php我写的

Route::get('contact', 'ContactController@index');

我认为点击以下网址" X"必须打印。但它说" Not Found"错误。

http://localhost/lapp/public/contact/index

我错过了什么?请指导我。

2 个答案:

答案 0 :(得分:0)

如果未激活apache module_rewrite。激活它。它肯定会奏效。

答案 1 :(得分:-1)

你的猜测是正确的。但问题在于你的URL。 它应该是http://localhost/lapp/public/contact

或者,您可以使用php artisan serve命令启动服务器,该服务器可以启动服务器,例如http://localhost:8080然后您可以访问以下网址:http://localhost:8080/contact

相关问题