示例页:/d/file/20210918/13.html
动态搜索列表:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = str_replace("searchid=","",$urls);
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sid");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where `keyboard` LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/e/search/result/?searchid='.$tr[searchid].'';
echo '搜索关键词:'.$tr[keyboard].'<br>';
echo '关键词url:'.$url.'<br>';
echo '搜索次数:'.$tr[onclick].'<hr>';
}
?>
伪静态版搜索列表代码:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = explode("=",$urls);
$sids = $sid[2];
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sids");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where keyboard LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/search-0-'.$tr[searchid].'.html';
echo '搜索关键词:'.$tr[keyboard].'<br>';
echo '关键词url:'.$url.'<br>';
echo '搜索次数:'.$tr[onclick].'<hr>';
}
?>
3、改进版,上边语句比如搜索游戏,会出现 游戏 相关。下边是排除掉了搜索词:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = explode("=",$urls);
$sids = $sid[2];
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sids");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where keyboard != '$res[keyboard]' and keyboard LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/search-0-'.$tr[searchid].'.html';
echo '<a class="related-word-list" href="'.$url.'" rel="external nofollow" target="_blank" style="padding-right: 10px;">'.$tr[keyboard].'</a>';
}
?>
样式自己调整。
自己做得测试结果:
http://ecms086.cncobo.com/search-0-6.html
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:115904045@qq.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明。