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.
http://www.bkjia.com/PHPjc/916063.htmlwww.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. ...