<!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;>


<h" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

18143453325 在線咨詢 在線咨詢
18143453325 在線咨詢
所在位置: 首頁(yè) > 營(yíng)銷資訊 > 網(wǎng)站運(yùn)營(yíng) > 404 頁(yè)面自動(dòng)跳轉(zhuǎn)到首頁(yè),TP(thinkphp)404頁(yè)面配置

404 頁(yè)面自動(dòng)跳轉(zhuǎn)到首頁(yè),TP(thinkphp)404頁(yè)面配置

時(shí)間:2023-04-21 14:06:01 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)

時(shí)間:2023-04-21 14:06:01 來(lái)源:網(wǎng)站運(yùn)營(yíng)

404 頁(yè)面自動(dòng)跳轉(zhuǎn)到首頁(yè),TP(thinkphp)404頁(yè)面配置:404 頁(yè)面代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>很抱歉,您搜索的書搬家啦-言書庫(kù)!</title>

<style type="text/css">

body {margin: 0px; padding:0px; font-family:"微軟雅黑", Arial, "Trebuchet MS", Verdana, Georgia,Baskerville,Palatino,Times; font-size:16px;}

div{margin-left:auto; margin-right:auto;}

a {text-decoration: none; color: #1064A0;}

a:hover {color: #0078D2;}

img { border:none; }

h1,h2,h3,h4 {

/* display:block;*/

margin:0;

font-weight:normal;

font-family: "微軟雅黑", Arial, "Trebuchet MS", Helvetica, Verdana ;

}

h1{font-size:44px; color:#0188DE; padding:20px 0px 10px 0px;}

h2{color:#0188DE; font-size:16px; padding:10px 0px 40px 0px;}

#page{width:910px; padding:20px 20px 40px 20px; margin-top:80px;}

.button{width:180px; height:28px; margin-left:0px; margin-top:10px; background:#009CFF; border-bottom:4px solid #0188DE; text-align:center;}

.button a{width:180px; height:28px; display:block; font-size:14px; color:#fff; }

.button a:hover{ background:#5BBFFF;}

</style>

</head>

<body>

<div id="page" style="border-style:dashed;border-color:#e4e4e4;line-height:30px;background:url(sorry.png) no-repeat right;">

<h1>腹有詩(shī)書氣自華~</h1>

<h2>言書庫(kù),完本小說(shuō)在線閱讀網(wǎng)址 </h2>

<meta http-equiv="refresh" content="1.5;url=http://www.yanshuku.com">

<font color="#666666">2秒內(nèi),若網(wǎng)頁(yè)未能自動(dòng)跳轉(zhuǎn),請(qǐng)點(diǎn)擊下面按鈕進(jìn)行跳轉(zhuǎn)!</font><br /><br />

<div class="button">

<a href="http://www.yanshuku.com" title="進(jìn)入首頁(yè)">立即進(jìn)入首頁(yè)</a>

</div>

</div>

</body>

</html>







TP配置:

無(wú)法加載模板跳向404頁(yè)面


/thinkphp/library/think/Dispatcher.class.php中176行

// 加載模塊的擴(kuò)展配置文件

load_ext_file(MODULE_PATH);

}else{

header("Location:/404.html");die;

// E(L(‘_MODULE_NOT_EXIST_‘).‘:‘.MODULE_NAME);

}

加上header跳轉(zhuǎn)頁(yè)面,404.html放在跟下




無(wú)法加載控制器跳向404頁(yè)面


創(chuàng)建一個(gè)EmptyController.class.php 代碼如下




namespace Home/Controller;

use Think/Controller;

class EmptyController extends Controller

{

public function _empty(){

$this->display(‘Error/404‘);//在Home/view中Error文件夾中

}

}

這樣就行

無(wú)法加載方法跳向404頁(yè)面

在/thinkphp/library/think/Controller.class.php在170行加上重跳轉(zhuǎn)404頁(yè)面

public function __call($method,$args) {

if( 0 === strcasecmp($method,ACTION_NAME.C(‘ACTION_SUFFIX‘))) {

if(method_exists($this,‘_empty‘)) {

// 如果定義了_empty操作 則調(diào)用

$this->_empty($method,$args);

}elseif(file_exists_case($this->view->parseTemplate())){

// 檢查是否存在默認(rèn)模版 如果有直接輸出模版

$this->display();

}else{

$this->display(‘Error/404‘);

// E(L(‘_ERROR_ACTION_‘).‘:‘.ACTION_NAME);

}

}else{

E(__CLASS__.‘:‘.$method.L(‘_METHOD_NOT_EXIST_‘));

    return;

  }

}

關(guān)鍵詞:配置

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點(diǎn)擊下載Chrome瀏覽器
關(guān)閉