【发布时间】:2019-02-22 08:48:52
【问题描述】:
我为我的应用程序开发了几个页面。现在我需要为这些页面添加链接。直到现在我通过 url 浏览打开这些页面。
我的 web.php 页面
// for books
Route::get('/book','BookController@create');
Route::post('/book','BookController@store');
Route::get('/book/{id}','BookController@edit');
Route::patch('/book/{id}', 'BookController@update');
// for ordered books
Route::get('/order','OrderedBookController@create');
Route::post('/order','OrderedBookController@store');
Route::get('/billSearch','OrderedBookController@searchBill');
Route::post('/billSearch','OrderedBookController@billPay');
Route::post('/billSearch/{id}', 'OrderedBookController@pay');
// for Books Out
Route::get('/booksout','BooksOutController@create');
Route::post('/booksout','BooksOutController@store');
路线对应的页面列表
book.blade.php
edit.blade.php
booksin.blade.php
booksout.blade.php
浏览这些页面的本地主机url是::
http://127.0.0.1:8000/book
http://127.0.0.1:8000/order
http://127.0.0.1:8000/billSearch // for Route::get('/billSearch','OrderedBookController@searchBill');
http://127.0.0.1:8000/booksout
由于我是通过路由而不是页面浏览我的页面,如何在我的网络应用程序中创建链接?
【问题讨论】:
-
与任何其他链接一样:
<a href="/book">Book</a>. -
最好的方法是创建命名路由并在 href="{{route('route_name')}}" 中使用这个名称
标签: php laravel laravel-5 laravel-blade