求助多分类 URL 地址怎么拼接
问题描述
在页面筛选列表的时候,如下图所示,不知道怎么样子才能把所以的条件都拼接到url上
比如 我类型这边我循环出来的模板是
<a href="{{request()->url()."?type=all"}}" rel="" name="type" class="all active">全部</a>
<a href="{{request()->url()."?type=1"}}" rel="" name="type" class="all active">医院</a>
<a href="{{request()->url()."?type=2"}}" rel="" name="type" class="all active">诊所</a>
省份循环出来的模板
<a href="{{request()->url()."?shengfen=all"}}" rel="" name="type" class="all active">全部</a>
<a href="{{request()->url()."?shengfen=1"}}" rel="" name="type" class="all active">多彩</a>
<a href="{{request()->url()."?shengfen=2"}}" rel="" name="type" class="all active">橙色</a>
那么 URL 地址拼接的话
选择类型后
localhost?type=all
再次选择省份
localhost?type=all?shengfen=2
按理说应该是
localhost?type=all&shengfen=2
这个应该怎么设计才合理呢,比如前段页面模板循环出来的时候,判断当前有没有参数,有的话就&
或者js判断? 好乱啊 !!! 求大家给个方案吧