ThinkPHP页面跳转success与error方法
首先是控制器中,可以使用下代码: config配置如下: 'TMPL_ACTION_ERROR' => 'Public:error', // 默认错误跳转对应的模板文件 'TMPL_ACTION_SUCCESS' => 'Public:success' , // 默认成功跳转对应的模板文件success.html 页面 位置:Tpl\default\Public\success.html
<{$msgTitle}>
<{$message}>
<{$error}>
系统将在 <{$waitSecond}> 秒后自动跳转,如果浏览器无法跳转,直接点击 这里 跳转
error页面 位置:Tpl\default\Public\success.html
<{$msgTitle}>
<{$message}>
<{$error}>
系统将在 <{$waitSecond}> 秒后自动跳转,如果浏览器无法跳转,直接点击 这里 跳转
在控制器中调用
第1个参数代表输出信息,第2个参数代表跳转路径 第3个参数是几秒后跳转
效果图
success.html代码
{__NOLAYOUT__}
<style type="text/css">
*{margin:;padding:;}
html,body{ overflow:hidden}
body{color:#;font:12px/1.5 Tahoma,Arial,"宋体",Helvetica,sans-serif;height:auto;width:%; background-color:#f9f9f9}
div{margin: auto;}
ul{list-style-type:none;}
.box{ border:5px solid #eee; width:480px; background-color:#fff;
margin-top:%;erflow:hidden;
}
.box-b{ border:1px solid #dfdbdb;width:478px;erflow:hidden;}
.box-title{ background:#549bd9;height:30px;line-height:33px;_line-height:30px;font-size: 14px;color:#fff; padding: 10px;}
.box-text{font:12px/1.5 "微软雅黑",Arial,"宋体",Helvetica,sans-serif; font-size:18px;color:#73787b;width:438px;
text-align:center; border:0px solid #; padding:20px; height:auto;word-wrap:break-word;
}
.box-button{overflow:hidden; text-align:right;}
.box-button a{ display: inline-block;
height:25px;line-height:23px;_line-height:25px;
text-align: center;
font-family:"微软雅黑";
font-size: 14px;
text-decoration: none;
padding:0px 5px;
margin:0px 10px;
}
.a-{ background-color:#eee; color:#; border:1px solid #dfdbdb;}
.a-{ background-color:#eee; color:#;border:1px solid #dfdbdb;}
</style>
<script>
function locahost(){
if("{$jumpUrl}"){
location.href="{$jumpUrl}";
}else{
window.history.back();
}
}
function closeWindow(){window.open('', '_self', '');window.close();}
var i = "{$waitSecond}"; if(i!=){window.close_id = setInterval(function() {if (i > ) {document.getElementById('time').innerHTML = i;i = i - ;} else {
locahost();clearInterval(window.close_id);}}, );}</script>
<div class="box">
<div class="box-b">
<div class="box-title">消息提示</div>
<div class="box-text">
{$message}
</div>
<div class="box-button"><a class="a-2" href="javascript:;" onclick="locahost()"><font id="time" style="color:red;">{$waitSecond}</font>秒后跳转到下一个页面</a><a class="a-1" href="{:U('Index/index')}">返回前台首页</a></div>
<div style="height:10px; overflow:hidden; width:100%; clear:both"></div>
</div>
</div>
</body>
</html>
ThinkPHP页面跳转success与error方法的更多相关文章
- 【转】ThinkPHP 页面跳转
ThinkPHP 提供了success 与error 方法用于带提示信息的页面跳转,如添加数据后显示提示信息并跳转等.success 方法用于操作成功后的提示,error 用于操作失败后的提示,二者使 ...
- ThinkPHP页面跳转、Ajax技巧详细介绍(十八)
原文:ThinkPHP页面跳转.Ajax技巧详细介绍(十八) ThinkPHP页面跳转.Ajax技巧详细介绍 一.页面跳转 $this->success('查询成功',U('User/test' ...
- 实现网页页面跳转的几种方法(meta标签、js实现、php实现)
1.meta标签实现 只需在head里加上下面这一句就行了,在当前页面停留0.1秒后跳转到目标页面 代码如下 复制代码 1 <meta http-equiv="refresh&quo ...
- js 控制页面跳转的5种方法
js 控制页面跳转的5种方法 编程式导航: 点击跳转路由,称编程式导航,用js编写代码跳转. History是bom中的 History.back是回退一页 Histiory.go(1)前进一页 Hi ...
- Jsp页面跳转和js控制页面跳转的几种方法
Jsp 页面跳转的几种方法 1. RequestDispatcher.forward() 在服务器端起作用,当使用forward()时,Servlet engine传递HTTP请求从当前的Servle ...
- HTML 页面跳转的五种方法
H方法TML 页面跳转的五种方法 下面列了五个例子来详细说明,这几个例子的主要功能是:在5秒后,自动跳转到同目录下的hello.html(根据自己需要自行修改)文件.1) html的实现 <he ...
- 实现网页页面跳转的几种方法大全(meta标签、js实现、php实现)
1.meta标签实现 只需在head里加上下面这一句就行了,在当前页面停留0.1秒后跳转到目标页面 代码如下 复制代码 1 <meta http-equiv="refresh&quo ...
- ASP.NET页面跳转的三种方法比较
在ASP.NET下,经常需要在页面之间跳转,下面我们来分别介绍一下关于.NET中Response.Redirect(),Sever.Execute(),Server.Transfer() 三种页面跳转 ...
- jquery/js/a标签实现当前页面跳转的两种方法
在逛购物网站首页时经常看到侧边导航栏,当我们点击导航栏中某一项时会跳转到当前页面的某一处 有两种方法实现,一种是利用js计算好各位置的高度,通过绑定事件使页面跳转到指定位置,另一种是利用a标签进行当前 ...
随机推荐
- C++ DLL
DLL(Dynamic Link Library)(1)DLL 的编制与具体的编程语言及编译器无关只要遵循约定的DLL接口规范和调用方式,用各种语言编写的DLL都可以相互调用.譬如Windows提供的 ...
- shell脚本学习系列之一---入门
参考:http://me.52fhy.com/shell-book/ 待后续整理...
- Mysql 递归获取多重数组数据
多重数据 $data ,获取顶级下的所有下级id $data array:3 [▼ 0 => array:7 [▼ "id" => 1 "created_at ...
- iOS9 新功能:Support Universal Links,iOS10 openUrl新函数
先看官方文档:https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalL ...
- idea Unable to open debugger port (127.0.0.1:58006) Address already in use: JVM_Bind 的解决办法
报错说端口58006 被占用了,于是去修改端口 重新dubug 发现换个端口号还是不行,同样的错误.有时候你把idea关闭重新打开依旧不起作用.最暴力的办法就是重启电脑... 问题解决: 查看使用中的 ...
- Android 目前最稳定和高效的UI适配方案
Android系统发布十多年以来,关于Android的UI的适配一直是开发环节中最重要的问题,但是我看到还是有很多小伙伴对Android适配方案不了解.刚好,近期准备对糗事百科Android客户端设计 ...
- js去除空格12种方法
注:本文非本人原著:原文作者: 黄卉 <js去除空格12种方法> //JS去除空格的方法目前共有12种: //实现1 String.prototype.trim = function() ...
- Confluence 6 用户提交的备份和恢复脚本
下面的代码是用户提交的,在使用的时候需要小心,因为 Atlassian 不提供这些代码的技术支持.如果你在使用或者修改这些代码的时候有任何问题,请粘贴到 post them to Atlassian ...
- EasyUI Layout 布局
1.在整个页面上创建布局(Layout) <!DOCTYPE html> <html> <head> <title>吹泡泡的魚-主页</title ...
- npm无反应的问题&npm常用命令
RT: windows安装完nodejs后做了相关环境变量配置后,cmd输入npm命令无反应,就光标一直闪,百度了半天终于找到解决办法 解决方法:C:\Users\Administrator(或你的账 ...