php框架

 首页 > php框架 > ThinkPHP > ThinkPHP中自定义错误页面和提示页面 - Thinkphp

ThinkPHP中自定义错误页面和提示页面 - Thinkphp

分享到:
【字体:
导读:
          在ThinkPHP中有两个方法时提示错误页面 _404( 错误信息 , 跳转的地址 );halt( 提示信息 );这两个函数都可以自定义错误页面在配置文件中加...

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

在ThinkPHP中有两个方法时提示错误页面 _404('错误信息','跳转的地址');halt('提示信息');
这两个函数都可以自定义错误页面在配置文件中加 'TMPL_EXCEPTION_FILE'=>'./Public/Tpl/error.html'
这样每次就会跳转到这个页面。

下面是我定制的错误页面

x

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

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

$this->error();

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

  1. "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. "http://www.w3.org/1999/xhtml">  
  3.  
  4. "Content-Type" content="text/html; charset=utf-8" />  
  5. 提示消息 - ThinkPHP  
  6.  
  7. "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.  
  15.  
  16.  
  17. "notice">  
  18.  
  19. "message">  
  20. "font: italic bold 2cm cursive,serif; color:green">  
  21. ok   
  22.  
  23. class="success" style="width:100%;text-align:left;padding-left:10px;padding-right:10px">  
  24. echo($message); ?>  
 
  • <else/>  
  • "font: italic bold 2cm cursive,serif; color:red">  
  • ×  
  •  
  • class="error" style="width:100%;text-align:left;padding-left:10px;padding-right:10px">  
  •  
  •  

  • 在( "sec" style="color:blue;font-weight:bold">echo($waitSecond); ?> )秒后自动跳转,或直接点击 "javascript:window.location=''">这里 跳转
     
  • "display:block;text-decoration:underline;cursor:pointer;line-height:25px" onclick="stop(this)">停止  
  •  
  •  
  •  
  •  
  •  
  • 分享到:
    ThinkPHP中Ajax返回 - Thinkphp
    ThinkPHP中Ajax返回 在ThinkPHP中可以直接使用ajax返回 $.post(handleUrl,{username:username.val(),content:content.val()},function(data) { //这里是接收返回来的内容。},&#039;json&#039;); 而在处理过程中有这个函数处理 $this->ajaxReturn(要返回的内容,&#039;json(json格式返回...
    thinkphp3.2.2 缩略图 多张生成 - Thi...
    thinkphp3.2.2 缩略图 多张生成 方法: public function dz_upload() { //上传多张缩略图   上传2张缩略图              if (isset($_FILES[&#039;ori_img&#039;])){             $upload = new \Think\UploadFile();// 实例化上传类   ...
    •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
    • 在这里……