【发布时间】:2017-05-20 12:25:45
【问题描述】:
我的看法是这样的:
...
<a class="btn btn-primary pull-right" style="margin-top: -10px;margin-bottom: 5px" href="{!! route('users.create.year', [$year]) !!}">
Add New
</a>
...
...
@foreach($testArray as $key)
...
<a class="btn btn-primary btn-xs" href="{!! route('users.create.year', [$key['display'], $year]) !!}">
<i class="glyphicon glyphicon-plus"></i>
</a>
...
@endforeach
...
我的路线是这样的:
Route::get('users/create/{year}/{display?}', 'UserController@create')
->name('users.create.year');
我的控制器是这样的:
public function create($year, $display = null)
{
echo $display.' : display <br>';
echo $param_thang. ' : year';die();
...
}
当我像这样调用 url 时:http://localhost/mysystem/public/users/create/2016,它可以工作。
结果是这样的:
: display
2016 : year
当我这样调用 url 时:http://localhost/mysystem/public/users/create/14144499452111901/2016
结果是这样的:
2016 : display
14144499452111901 : year
看起来很奇怪,结果反了
为什么会这样?
【问题讨论】:
标签: php laravel laravel-5.3