日期:2014-05-17 浏览次数:20650 次
<a href="/search.php?area="内地">内地</a>
<a href="/search.php?type="动作">动作</a>
<a href="/search.php?year="2011">2011</a>
echo join(' - ', $_GET), '<br>';
$dict = array(
'area' => array('内地', '港台'),
'type' => array('动作', '爱情'),
'year' => array('2001', '2013'),
);
foreach($dict as $key=>$item) {
$param = $_GET;
foreach($item as $v) {
$param[$key] = $v;
$t = http_build_query($param);
echo "<a href='/search.php?$t'>$v</a> ";
}
echo '<br>';
}
<?php
session_start();
if(! isset($_SESSION['search']))
$_SESSION['search'] = array();
$_SESSION['search'] = array_merge($_SESSION['search'], $_GET);
echo join(' - ', $_SESSION['search']), '<br>';
?>
<a href="/search1.php?area=内地">内地</a>
<a href="/search1.php?type=动作">动作</a>
<a href="/search1.php?year=2011">2011</a>
session_start();
if(! isset($_SESSION['search'])
------解决方案--------------------
! $_GET)
$_SESSION['search'] = array();
$_SESSION['search'] = array_merge($_SESSION['search'], $_GET);