简体   繁体   English

如何在Laravel Route中创建两个或更多网址

[英]how to make two or more url in Laravel Route

I want to make url like this http://127.0.0.1:8000/post/edit_1=1&edit_2=2 to pass to my controller 我想像这样的网址http://127.0.0.1:8000/post/edit_1=1&edit_2=2传递给我的控制器

I try route like this Route::get('post/edit_1={id}&edit_2={id2}', 'PostController@index')->name('post.index'); 我尝试这样的Route::get('post/edit_1={id}&edit_2={id2}', 'PostController@index')->name('post.index');

and View like this <a href="{{ route('post.index', '$id', '$id2') }}">Click Here</a> 和这样的视图<a href="{{ route('post.index', '$id', '$id2') }}">Click Here</a>

But I always got error, can someone fix my code 但是我总是出错,有人可以修复我的代码

i think a simple route like this 我认为这样的简单路线

Route::get('post/{1}/{2}', 'PostController@index')->name('post.index') 

and call 并打电话

<a href="{{ route('post.index', ['$id','$id2'] )}}">Click Here</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM