PHP搜索页面如何实现分类检索?
<a href="/search.php?area="内地">内地</a><br /> <a href="/search.php?type="动作">动作</a><br /> <a href="/search.php?year="2011">2011</a>
echo join(' - ', $_GET), '<br>';<br /> $dict = array(<br /> 'area' => array('内地', '港台'),<br /> 'type' => array('动作', '爱情'),<br /> 'year' => array('2001', '2013'),<br /> );<br /> foreach($dict as $key=>$item) {<br /> $param = $_GET;<br /> foreach($item as $v) {<br /> $param[$key] = $v;<br /> $t = http_build_query($param);<br /> echo "<a href='/search.php?$t'>$v</a> ";<br /> }<br /> echo '<br>';<br /> }<br />
<?php<br /> session_start();<br /> if(! isset($_SESSION['search']))<br /> $_SESSION['search'] = array();<br /> $_SESSION['search'] = array_merge($_SESSION['search'], $_GET);<br /> echo join(' - ', $_SESSION['search']), '<br>';<br /> ?><br /> <a href="/search1.php?area=内地">内地</a><br /> <a href="/search1.php?type=动作">动作</a><br /> <a href="/search1.php?year=2011">2011</a><br />
session_start();<br> if(! isset($_SESSION['search']) <br><font color="#FF8000">------解决方案--------------------</font><br> ! $_GET)<br> $_SESSION['search'] = array();<br> $_SESSION['search'] = array_merge($_SESSION['search'], $_GET); <div class="clear"> </div>