php提示框问题:请讲一下,下面这个程序的流程(详细点),谢谢!
<?phpif(!defined('BASEPATH'))exit('Nodirectscriptaccessallowed');/***提示类*@authorzhimi...
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * 提示类 * @author zhiming * */ class Tips { /** * 成功的消息提示框 * @paramstring$mess用示输出提示消息 * @paramint$timeout设置跳转的时间,单位:秒 * @paramstring$location设置跳转的新位置 */ public function success($mess="操作成功", $timeout=1, $location="", $target="top.window"){ if($location==""){ if(!empty($_SERVER['HTTP_REFERER'])){ $location = $_SERVER['HTTP_REFERER']; }else{ $location = site_url('user/user/login'); } } $location = $target.".location.href='$location'"; $this->tiptpl($mess); echo $str =<<<S <script> var time=$timeout; var tt=setInterval(function(){ time--; if(time<=0){ $location return; } }, 1000); function stop(obj){ clearInterval(tt); obj.style.display="none"; } </script> S; exit; } /** * 失败的消息提示框 * @paramstring$mess用示输出提示消息 * @paramint$timeout设置跳转的时间,单位:秒 * @paramstring$location设置跳转的新位置 */ public function error($mess="操作失败", $timeout=1, $location="", $target="window"){ if($location==""){ if(!empty($_SERVER['HTTP_REFERER'])){ $location = $_SERVER['HTTP_REFERER']; }else{ $location = site_url('user/user/login'); } } $location = $target.".location.href='$location'"; $this->tiptpl($mess); echo $str =<<<S <script> var time=$timeout; var tt=setInterval(function(){ time--; if(time<=0){ $location return; } }, 1000); function stop(obj){ clearInterval(tt); obj.style.display="none"; } </script> S; exit; } private function tiptpl($mess){ echo $str =<<<S <html><head> <meta charset="utf-8"> <title></title> <meta http-equiv="expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <style> *{ font-size:12px; } dt, dl, dd { margin: 0px; padding: 0px; } .tip_wind { border: 5px solid rgb(194, 228, 255); background: none repeat scroll 0% 0% rgb(247, 252, 255); position: absolute; width: 420px; padding:0px; } .tip_wind dd { float: left; padding: 15px 15px 25px 0px; width: 300px; } .tip_wind dt { width: 42px; height: 42px; float: left; overflow: hidden; margin: 20px 15px 20px 40px; background-position: -170px -30px; display: inline; padding: 0px; } .tip_wind dd h4 { margin: 0px; padding:0px; font-size: 14px; font-weight: 700; color: #333; padding: 5px 0px 0px; } .tip_wind dd div { margin: 0px; padding: 5px 0px 8px; } </style> </head> <body> <div style="position: absolute; left: -10000px; z-index: 1011;" class="" id="pw_box"></div> <div class="wrap"> <div class="tip_wind" style="position: absolute;left:50%;margin-left:-200px;top:25%;"> <dl> <dt> </dt> <dd> <h4>提示</h4> <div>$mess</div> </dd> </dl> <div class="c"></div> </div> </div> </body> </html> S; } }
展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询