Home  >  Article  >  Backend Development  >  Examples of custom error pages and prompt pages in ThinkPHP, thinkphp examples_PHP tutorial

Examples of custom error pages and prompt pages in ThinkPHP, thinkphp examples_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:13:231034browse

Examples of custom error pages and prompt pages in ThinkPHP, thinkphp examples

The example in this article describes how to customize error pages and prompt pages in ThinkPHP. Share it with everyone for your reference. The specific implementation method is as follows:

When there are two methods in ThinkPHP, an error page is prompted _404('error message','jump address');halt('prompt message');
Both functions can customize the error page by adding

Copy code to the configuration file. The code is as follows:
'TMPL_EXCEPTION_FILE'=>'./ Public/Tpl/error.html'

This will jump to this page every time.

The following is my customized error page

Copy code The code is as follows:
will automatically jump after (3) seconds, or click here directly to jump to stop

$this->success('error message','jump address (preferably use U())', time);

$this->error();

The following is the prompt page I changed in ThinkPHP

Copy code The code is as follows:




Prompt message - ThinkPHP








ok







×






Automatically jump after ( ) seconds, Or click directlyhere Jump

Stop



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

I hope this article will be helpful to everyone’s ThinkPHP framework programming.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/916063.htmlTechArticleExamples of custom error pages and prompt pages in ThinkPHP, thinkphp examples This article describes the examples of custom error pages and prompts in ThinkPHP Prompt page method. Share it with everyone for your reference. ...
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