搜索栏不支持https怎么解决

发布时间:2022-03-25 13:59:01 作者:iii
来源:亿速云 阅读:138

这篇文章主要介绍“搜索栏不支持https怎么解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“搜索栏不支持https怎么解决”文章能帮助大家解决问题。

  第一种方法:通过js实现

  但是最近做一个客户需求的时候突然想到了一个曲线求国的办法,反正我测试百度站内搜索在https网站上是能用了,而且方法特别的暴力...

  思路就是,做一个input,做一个button,在input里面输入关键词,用js控制点击button直接打开百度站内搜索url+关键词。反正能用了,我也不知道这么干对不对。。。

  上代码:

  <inputtype="text"name="q"id="bdcsMain"value="百度站内搜索"onfocus="if(value=='百度站内搜索'){value=''}"onblur="if(value==''){value='百度站内搜索'}">

  <buttonclass="search-submit"id="btnPost"type="submit"onclick="window.open('http://zhannei.baidu.com/cse/search?s=1849457021752692468&entry=1&q='+document.getElementById('bdcsMain').value)">搜索</button>

  只需要复制你百度站内搜索结果页的url替换掉上面代码中的“http://zhannei.baidu.com/cse/search?s=1849457021752692468&entry=1&q=”就OK了。

  第二种方法:通过php跳转实现

  搜索代码不是js的

  <formaction="http://so.php.cn/cse/search"method="get"target="_blank"class="bdcs-search-form"id="bdcs-search-form">

  <inputname="s"value="10520733385329581432"type="hidden">

  <inputname="entry"value="1"type="hidden">

  <inputname="ie"value="gbk"type="hidden">

  <inputname="nsid"value="3"type="hidden">

  <inputname="ie"value="gbk"type="hidden">

  <inputtype="text"placeholder="请输入您感兴趣的关键字"value=""id="search_txt1"maxlength="18"class="search_txt"name="q">

  <inputclass="search_btn"value="搜索"type="submit">

  </form>

  修改以后将action换成本地的php文件

  <pclass="search">

  <formaction="/do/search.php"method="get"target="_blank"class="bdcs-search-form"id="bdcs-search-form">

  <inputname="s"value="10520733385329581432"type="hidden">

  <inputname="entry"value="1"type="hidden">

  <inputname="ie"value="gbk"type="hidden">

  <inputname="nsid"value="3"type="hidden">

  <inputname="ie"value="gbk"type="hidden">

  <inputtype="text"placeholder="请输入您感兴趣的关键字"value=""id="search_txt1"maxlength="18"class="search_txt"name="q">

  <inputclass="search_btn"value="搜索"type="submit">

  </form>

  </p>

  search.php如下

  <?php

  error_reporting(E_ALL&~E_NOTICE);

  $s=is_numeric($_GET['s'])?$_GET['s']:0;

  $entry=$_GET['entry']?intval($_GET['entry']):0;

  $nsid=$_GET['nsid']?intval($_GET['nsid']):0;

  $ie=$_GET['ie']?substr($_GET['ie'],0,3):0;

  $q=$_GET['q']?urlencode($_GET['q']):'';

  $url_str="http://so.jb51.net/cse/search?s=$s&entry=$entry&ie=$ie&nsid=$nsid&ie=$ie&q=$q";

  header("Location:$url_str");

  ?>

关于“搜索栏不支持https怎么解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注亿速云行业资讯频道,小编每天都会为大家更新不同的知识点。

推荐阅读:
  1. 搜索栏不支持https如何解决
  2. phpwind支不支持https

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

https

上一篇:html中如何使用position

下一篇:css中为什么z-index会失效

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》