Url路径如何从文件路径名到laravel中的另一个名字

How the Url path from file path name to another name in laravel

鳍在路线代码下方。

Route::get('clientlayout.main.index','InvoiceTicketController@show');
Route::get('clientlayout.main.mydomains','InvoiceTicketController@set');

当我 运行 这些路线时,我得到 url 作为

http://localhost:8000/clientlayout.main.index and http://localhost:8000/clientlayout.main.mydomains.

我希望我的 Url 更改如下:http://localhost:8000/index and http://localhost:8000/mydomains

建议我更改路由以纠正此问题的解决方案。

Route::get('/index','InvoiceTicketController@show');
Route::get('/mydomains','InvoiceTicketController@set');

对于命名路由,你可以像这样使用

 Route::get('/index','InvoiceTicketController@show')->name('clientlayout.main.index');

更多详情请关注

https://laravel.com/docs/5.6/routing#named-routes

你应该试试这条路线。

Route::get('/clientlayout/main/index','InvoiceTicketController@show');
Route::get('/clientlayout/main/mydomains','InvoiceTicketController@set');

Url 正在制作

http://localhost:8000/clientlayout/main/index
http://localhost:8000/clientlayout/main/mydomains

或者你应该试试

Route::get('/index','InvoiceTicketController@show');
Route::get('/mydomains','InvoiceTicketController@set');

那么Url正在制作

http://localhost:8000/index
http://localhost:8000/mydomains