Home > php教程 > php手册 > body text

ThinkPHP中自定义错误页面和提示页面实例

WBOY
Release: 2016-06-06 20:16:57
Original
1206 people have browsed it

这篇文章主要介绍了ThinkPHP中自定义错误页面和提示页面的方法,以一个完整的实例形式详细讲述了ThinkPHP实现自定义错误提示与跳转页面的方法,是非常常见的实用技

本文实例讲述了ThinkPHP中自定义错误页面和提示页面的方法。分享给大家供大家参考。具体实现方法如下:

在ThinkPHP中有两个方法时提示错误页面 _404('错误信息','跳转的地址');halt('提示信息');
这两个函数都可以自定义错误页面在配置文件中加

复制代码 代码如下:

'TMPL_EXCEPTION_FILE'=>'./Public/Tpl/error.html'


这样每次就会跳转到这个页面。

下面是我定制的错误页面

复制代码 代码如下:

在( 3 )秒后自动跳转,,或直接点击 这里 跳转 停止

$this->success('错误信息','跳转的地址(最好用U())',时间);

$this->error();

下面是我改变ThinkPHP中的提示页面

复制代码 代码如下:

  
  

  
  
提示消息 - ThinkPHP  
 
  
  
  
  
 
  

  
ok   

  
  
  
  
  

  
×  

  
  
  

  
在( )秒后自动跳转,或直接点击 这里 跳转
  
停止  

  
  
<script> <br /> var seco=document.getElementByIdx_x("sec"); <br /> var time=<&#63;php echo($waitSecond); &#63;>; <br /> var tt=setInterval(function(){ <br /> time--; <br /> seco.innerHTML=time; <br /> if(time<=0){ <br /> window.location='<&#63;php echo($jumpUrl); &#63;>' <br /> return; <br /> } <br /> }, 1000); <br /> function stop(obj){ <br /> clearInterval(tt); <br /> obj.style.display="none"; <br /> } <br /> </script>  
  

希望本文所述对大家的ThinkPHP框架程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!