[英]Laravel - route leading to a closure
我不是MVC的新手,而是Laravel的新手。 我已經設法在Windows 8.1上使用WAMP安裝了它。 我轉到根URL( http://localhost/public/
)並獲得Laravel徽標和“您已經到達”。 一行文字。
現在,我想嘗試一下, 文檔告訴我下面的代碼應該可以工作。
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function()
{
return View::make('hello');
});
Route::get('users', function () {
return 'users!';
});
導航到http://localhost/public/users
users
時應該獲取文本users
,而不是404。我在做什么錯?
您的路由文件中的代碼應如下所示
Route::get('/users', function () {
return 'users!';
});
試試看!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.