【发布时间】:2018-01-31 03:51:44
【问题描述】:
我在这条路线上遇到了这个例外:http://localhost:8000/ 和我在 routes.php 文件中写的其他路线以及我写的时候
php 工匠路线:列表
我收到了这条消息
您的应用程序没有任何路由。
我没有更改我的代码中的任何内容并且它运行成功。我搜索了它,但我找不到确切的答案为什么会发生这个问题。 这是routes.php
<?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 controller to call when that URI is requested.
|
*/
Route::get('/', function () {
$name = ['saba','safavi'];
return view('welcome'/*,compact('name')*/);
});
Route::get('/sabasafavi', function () {
return "Salam saba safavi";
});
Route::get('/contact-us', function () {
return view("contact-us");
});
\Illuminate\Support\Facades\Route::get('/user/{id}',function ($id){
return "hello user : ".$id;
})/*->where(['id'=>'[0-5]+'])*/;
\Illuminate\Support\Facades\Route::get('/user/{name}/comment/{number}',function ($name,$number){
$comment = "Hello ".$name." this is your comment</br> number : ".$number;
return $comment;
});
/*Route::post('/send',function (){
return "OK information saved successfully";
});*/
【问题讨论】:
-
与我们分享 web.php 文件?
-
显示你的
routes.php -
哪个版本的 laravel 5?
-
Laravel 框架版本 5.1.46 (LTS)
-
有什么理由在新项目中使用旧版本?