国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > ThinkPHP > 正文

ThinkPHP中自定義錯誤頁面和提示頁面

2024-09-09 15:19:30
字體:
來源:轉載
供稿:網友

在ThinkPHP中有兩個方法時提示錯誤頁面 _404('錯誤信息','跳轉的地址');halt('提示信息');
這兩個函數都可以自定義錯誤頁面在配置文件中加 'TMPL_EXCEPTION_FILE'=>'./Public/Tpl/error.html'
這樣每次就會跳轉到這個頁面。

下面是我定制的錯誤頁面

x

在( 3 )秒后自動跳轉,或直接點擊 這里 跳轉 停止

$this->success('錯誤信息','跳轉的地址(最好用U())',時間);

$this->error();

下面是我改變ThinkPHP中的提示頁面

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5. <title>提示消息 - ThinkPHP</title>  
  6.  
  7. <style type="text/css">  
  8. body { font: 75% Arail; text-align: center; }  
  9. #notice { width: 300px; background: #FFF; border: 1px solid #BBB; background: #EEE; padding: 3px;  
  10. position: absolute; left: 50%; top: 50%; margin-left: -155px; margin-top: -100px; }  
  11. #notice div { background: #FFF; padding: 30px 0 20px; font-size: 1.2em; font-weight:bold }  
  12. #notice p { background: #FFF; margin: 0; padding: 0 0 20px; }  
  13. a { color: #f00} a:hover { text-decoration: none; }  
  14. </style>  
  15. </head>  
  16. <body>  
  17. <div id="notice">  
  18.  
  19. <present name="message">  
  20. <p style="font: italic bold 2cm cursive,serif; color:green">  
  21. ok   
  22. </p>  
  23. <div class="success" style="width:100%;text-align:left;padding-left:10px;padding-right:10px">  
  24. <?php echo($message); ?>  
  25. </div>  
  26. <else/>  
  27. <p style="font: italic bold 2cm cursive,serif; color:red">  
  28. ×  
  29. </p>  
  30. <div class="error" style="width:100%;text-align:left;padding-left:10px;padding-right:10px">  
  31. </div>  
  32. </present>
  33. <p>  
  34. 在( <span id="sec" style="color:blue;font-weight:bold"><?php echo($waitSecond); ?></span> )秒后自動跳轉,或直接點擊 <a href="javascript:window.location='<?php echo($jumpUrl); ?>'">這里</a> 跳轉<br>  
  35. <span style="display:block;text-decoration:underline;cursor:pointer;line-height:25px" onclick="stop(this)">停止</span>  
  36. </p>  
  37. </div>  
  38. <script>  
  39. var seco=document.getElementByIdx_x("sec");  
  40. var time=<?php echo($waitSecond); ?>;  
  41. var tt=setInterval(function(){  
  42. time--;  
  43. seco.innerHTML=time;  
  44. if(time<=0){  
  45. window.location='<?php echo($jumpUrl); ?>' 
  46. return;  
  47. }  
  48. }, 1000);  
  49. function stop(obj){  
  50. clearInterval(tt);  
  51. obj.style.display="none";  
  52. }  
  53. </script>  
  54. </body>  
  55. </html> 

上一篇:返回列表

下一篇:ThinkPHP中Ajax返回

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 永靖县| 赣榆县| 宁化县| 满城县| 通城县| 邵阳县| 湖口县| 靖安县| 镇原县| 上犹县| 普安县| 潞城市| 通州市| 遂昌县| 南江县| 大悟县| 鹤庆县| 福海县| 徐闻县| 莱阳市| 武隆县| 曲水县| 阳山县| 长汀县| 武隆县| 南华县| 郁南县| 志丹县| 星座| 徐水县| 治县。| 祁连县| 荔浦县| 苗栗市| 盘锦市| 开鲁县| 延寿县| 育儿| 金平| 玉门市| 晴隆县|