先看看效果
config.php配置文件
// 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
success,error采用默认配置,修改其dispatch_jump.tpl模板文件即可
也可以件success的模板文件与error的模板文件分开即创建两个模板文件
dispatch_jump.tpl文件如下
{__NOLAYOUT__}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="__PUBLIC__/style/jquery-2.1.0.js"></script> // 加载jquery文件
<script src="__PUBLIC__/lib/layer/layer.js"></script> // 加载layer库文件
<title>跳转提示</title>
</head>
<body>
<input type="hidden" id="msg" name="msg" value="<?php echo(strip_tags($msg));?>" />
<input type="hidden" id="url" name="url" value="<?php echo($url);?>" />
<input type="hidden" id="wait" name="wait" value="<?php echo($wait);?>" />
<script type="text/javascript">
var msg = $("#msg").val();
var urll = $("#url").val();
var wait = $("#wait").val();
(function(){
var index = layer.open({
anim: 3, //默认动画风格
content: msg,
yes:function(index,layero){
location.href = urll;
layer.close(index);
}
});
var interval = setInterval(function(){
var time = --wait;
if(time <= 0) {
location.href = urll;
clearInterval(interval);
};
}, 1000);
})();
</script>
</body>
</html>