a标签传过来的参数拼接连接,实现联合查询,该如何解决

WBOY
Release: 2016-06-13 13:48:41
Original
1182 people have browsed it

a标签传过来的参数拼接连接,实现联合查询
a标签传过来的参数拼接连接,实现联合查询


就像www.movie.hao123.com 左边标签选项卡那样,实现组合查询。

------解决方案--------------------
不明白。。。。
------解决方案--------------------
类似这个 http://topic.csdn.net/u/20111109/21/5fa4161d-bbbf-482f-bf1e-34c362fc79d7.html
------解决方案--------------------
可以用js 修改改2007 的属性呀,先回去经典的href属性,然后获取2007的href属性,然后拼装下在付给2007 就可以了。
具体的js代码,就不用写了吧,可以用jquery 很简单就可以实现的。
------解决方案--------------------
第三次粘贴,看看是否有帮助。

PHP code

$pre_url = $_SERVER['HTTP_REFERER'];
$t = parse_url($pre_url);
$a1 = array();
$a2 = array();

parse_str($t['query'],$a1);
parse_str($_SERVER['QUERY_STRING'],$a2);

$sort = array('a','b','c','d');//初始排序

if (!empty($a2['sort'])){
    $t = explode(',', $a2['sort']);//请求方式
    $t1 = array_diff($sort, $t);
    foreach ($sort as &$v){
        if (in_array($v,$t)){
            $tmp = array_diff($t, array($v));
            if (!empty($tmp))
            $v .= ','.implode(',', array_diff($t, array($v)));
        }else{
            $v .= ','.$a2['sort'];
        }
    }
}
echo sprintf('
<a href="%s">clear</a>
<a href="?sort=%s">a</a>
<a href="?sort=%s">b</a>
<a href="?sort=%s">c</a>
<a href="?sort=%s">d</a>
',$_SERVER['PHP_SELF'],$sort[0],$sort[1],$sort[2],$sort[3]);
<br><font color="#e78608">------解决方案--------------------</font><br>换了个面孔,加了点注释.<br>
Copy after login
PHP code

$query_string = $_SERVER['QUERY_STRING'];//获取此次请求的条件串

$sort = array('a=1','b=2','c=3','d=4');//初始条件
$dep = '&';//分隔符,可以用于rewrite

if (!empty($query_string)){
    $current_options = explode($dep, $query_string);//当前请求条件数组
    echo '<pre class="brush:php;toolbar:false">';
    print_r($current_options);//输出条件,查看当前的条件.
    echo '
Copy after login
'; foreach ($sort as &$v){//此处循环是用来改变初始条件数组 if (in_array($v,$current_options)){//判断当前数组成员是否已经存在 $tmp = array_diff($current_options, array($v));//差集用来添加 if (!empty($tmp)){ $v .= $dep.implode($dep, $tmp); } }else{//不存在即添加 $v .= $dep.$query_string; } } } echo sprintf(' clear a b c d ',$_SERVER['PHP_SELF'],$sort[0],$sort[1],$sort[2],$sort[3]);
------解决方案--------------------
探讨

换了个面孔,加了点注释.
PHP code

$query_string = $_SERVER['QUERY_STRING'];//获取此次请求的条件串

$sort = array('a=1','b=2','c=3','d=4');//初始条件
$dep = '&';//分隔符,可以用于rewrite

if (!empty($query_string)){
$curren……
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template