久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么實(shí)現(xiàn)301重定向跳轉(zhuǎn)

      方法:1、用“header('HTTP/1.1 301 Moved Permanently');header('Location:URL地址');”語(yǔ)句跳轉(zhuǎn);2、用“header('Location:URL',true,301)”語(yǔ)句跳轉(zhuǎn)。

      php怎么實(shí)現(xiàn)301重定向跳轉(zhuǎn)

      本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版,DELL G3電腦

      php實(shí)現(xiàn)301重定向跳轉(zhuǎn)

      網(wǎng)上搜了一圈都是用

      header('HTTP/1.1 301 Moved Permanently');

      再配合

      header('Location: https://www.php.cn');

      完成的。

      總感覺(jué)一句話干不完,再加上HTTP/2啥的都出來(lái)許久了還寫(xiě)了個(gè)HTTP/1.1看著不太爽,當(dāng)然寫(xiě)成HTTP/2或是HTTP/1.0也沒(méi)事,但是不管寫(xiě)什么總之有種表述不清的感覺(jué)(比如寫(xiě)的HTTP/1.1實(shí)際訪問(wèn)時(shí)是HTTP/2——訪問(wèn)的時(shí)候該HTTP/2的時(shí)候還是HTTP/2也沒(méi)問(wèn)題不會(huì)亂變HTTP/1.1

      又去 php.net 尋覓一番,發(fā)現(xiàn) Header 可以這樣用

      header ( string $header [, bool $replace = TRUE [, int $http_response_code ]] )

      這就好辦了,一句話

      header('Location: https://www.php.cn', true, 301);

      完事,哈哈哈哈哈哈

      額外再提一句,如果要自適應(yīng)HTTPS/HTTP的話,這樣就可以了:

      header('Location: //www.php.cn', true, 301);

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)