【发布时间】:2019-03-19 20:23:58
【问题描述】:
我的应用程序中有一个名为“工作”的页面,所有工作都将在其中显示。 我在同一页面上有搜索工作输入字段 用户使用输入字段搜索工作时,会将他重定向到“jobs?keyword=abc” 而且我还有一个工作过滤器部分,用户可以在其中按“位置、合同类型”过滤工作。
我已经通过一些 javascript 创建了表单,用户填写了一些字段,这些字段只能通过表单提交。
即
if user searches a job by keyword then url will be like "jobs?keyword=abc".
if user filter jobs by location then url be like "jobs?location=abc".
if user filter jobs by contract types then url be like "jobs?contract_type=abc".
if user filter jobs by keyword and contract types then url be like "jobs?keyword=abc&contract_type=abc".
每次用户提交表单 url 都会发生变化。
所以我的问题是如何处理路由上的动态 url
目前我的路线中有这个 Route::get('jobs', 'todocontroller@jobs');
还有我的控制器 todocontroller.php
public function jobs()
{
//some code here
}
提前感谢任何帮助。
【问题讨论】: