欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

百度站內(nèi)搜索不支持https的解決方法(已測(cè)試)

  發(fā)布時(shí)間:2018-02-07 16:48:37   作者:佚名   我要評(píng)論
這篇文章主要介紹了百度站內(nèi)搜索不支持https的解決方法,需要的朋友可以參考下

最近手機(jī)端開(kāi)啟了https,為了綠鎖需要解決如下問(wèn)題:

1、圖片

2、js

3、css樣式

4、form查詢(xún)也要用https

第一種方法:通過(guò)js實(shí)現(xiàn)

但是最近做一個(gè)客戶(hù)需求的時(shí)候突然想到了一個(gè)曲線(xiàn)求國(guó)的辦法,反正我測(cè)試百度站內(nèi)搜索在https網(wǎng)站上是能用了,而且方法特別的暴力...

思路就是,做一個(gè)input,做一個(gè)button,在input里面輸入關(guān)鍵詞,用js控制點(diǎn)擊button直接打開(kāi)百度站內(nèi)搜索url+關(guān)鍵詞。反正能用了,我也不知道這么干對(duì)不對(duì)。。。

上代碼:

<input type="text" name="q" id="bdcsMain" value="百度站內(nèi)搜索" onfocus="if (value =='百度站內(nèi)搜索'){value =''}" onblur="if (value ==''){value='百度站內(nèi)搜索'}" >
 <button class="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>

只需要復(fù)制你百度站內(nèi)搜索結(jié)果頁(yè)的url替換掉上面代碼中的“http://zhannei.baidu.com/cse/search?s=1849457021752692468&entry=1&q=”就OK了。

第二種方法:通過(guò)php跳轉(zhuǎn)實(shí)現(xiàn)

搜索代碼不是js的

<form action="http://so.jb51.net/cse/search" method="get" target="_blank" class="bdcs-search-form" id="bdcs-search-form">
		<input name="s" value="10520733385329581432" type="hidden">
        <input name="entry" value="1" type="hidden">
        <input name="ie" value="gbk" type="hidden">
        <input name="nsid" value="3" type="hidden">
        <input name="ie" value="gbk" type="hidden">
<input type="text" placeholder="請(qǐng)輸入您感興趣的關(guān)鍵字" value="" id="search_txt1" maxlength="18" class="search_txt" name="q">
<input class="search_btn" value="搜 索" type="submit">
</form>

修改以后將action換成本地的php文件

<div class="search">
<form action="/do/search.php" method="get" target="_blank" class="bdcs-search-form" id="bdcs-search-form">
		<input name="s" value="10520733385329581432" type="hidden">
        <input name="entry" value="1" type="hidden">
        <input name="ie" value="gbk" type="hidden">
        <input name="nsid" value="3" type="hidden">
        <input name="ie" value="gbk" type="hidden">
<input type="text" placeholder="請(qǐng)輸入您感興趣的關(guān)鍵字" value="" id="search_txt1" maxlength="18" class="search_txt" name="q">
<input class="search_btn" value="搜 索" type="submit">
</form>
</div>

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");
?>

這樣就完成了,大家可以根據(jù)需要自行修改。第二種方法腳本之家原創(chuàng)文章,希望大家多多支持我們。

相關(guān)文章

最新評(píng)論