Laravel-视图-router()不起作用或我只是傻了

时间:2018-12-11 04:28:39

标签: php laravel

这是我的web.php

Route::get('read/{book_id}/{part_id}', 'BookPartController@show')->name('read');

这是景观

<a href="{{ route('read', [$part->book_id, $part->part_id]) }}">

我希望结果是mysite.com/read/808/121,尽管结果是这个mysite.com/read/808

2 个答案:

答案 0 :(得分:1)

尝试此操作,将键添加到数组:

<a href="{{ route('read', 
       ['book_id' => $part->book_id, 'part_id' => $part->part_id]) }}">

答案 1 :(得分:0)

正确的方法:

<a href="{{ route('read', ['book_id' => $part->book_id, 'part_id' => $part->part_id]) }}">