第一種:利用header()函數(shù)進(jìn)行重定向,這也是我用的較多的。(注意!locationhe和“:”之間不能有空格,否則無作用!)
?php header('content-type:text/html;charset=uft-8); //重定向頁面 header('location:index.php'); ?>
第二種:利用HTML 頭部中的 meta標(biāo)簽,定義http-equiv=refresh 和content=”跳轉(zhuǎn)花費的時間(秒為單位);url=跳轉(zhuǎn)地址”
!DOCTYPE html> html lang="en"> head> meta charset="UTF-8"> //跳轉(zhuǎn)頁面,跳轉(zhuǎn)時間:3秒鐘,目標(biāo)地址:index.php meta http-equiv="refresh" content="3;url=index.php"> title>skip.../title> /head>
或者
?php header('content-type:text/html;charset=utf-8'); $url='index.php'; ?> !DOCTYPE html> html lang="en"> head> meta charset="UTF-8"> //跳轉(zhuǎn)頁面,跳轉(zhuǎn)時間:2秒鐘,目標(biāo)地址:index.php meta http-equiv="refresh" content="2;url=?php echo $url; ?>"> title>skip.../title> /head>
第三種:利用javascript進(jìn)行跳轉(zhuǎn)
?php header('content-type:text/html;charset=utf-8'); $url='index.php'; //立即跳轉(zhuǎn)至目標(biāo)頁面 echo script>window.location.href='$url';/script>; ?>
以上就是PHP中重定向頁面的三種方法。
到此這篇關(guān)于php中重定向網(wǎng)頁跳轉(zhuǎn)方法總結(jié)案例教程的文章就介紹到這了,更多相關(guān)php中重定向網(wǎng)頁跳轉(zhuǎn)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
標(biāo)簽:白城 洛陽 赤峰 金華 七臺河 酒泉 溫州 怒江
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《php中重定向網(wǎng)頁跳轉(zhuǎn)方法總結(jié)案例教程》,本文關(guān)鍵詞 php,中,重定向,網(wǎng)頁,跳轉(zhuǎn),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。