search
Homephp教程php手册ThinkPHP中自定义错误页面和提示页面实例

这篇文章主要介绍了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框架程序设计有所帮助。

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.