1、效果图

2、上干货

  • 为了增加对移动设备的支持,在  /application/common.php加入以下函数:

     function isMobile()
    {
    if (isset ($_SERVER['HTTP_X_WAP_PROFILE']))
    {
    return true;
    }
    if (isset ($_SERVER['HTTP_VIA']))
    {
    return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
    }
    if (isset ($_SERVER['HTTP_USER_AGENT']))
    {
    $clientkeywords = array ('nokia',
    'sony',
    'ericsson',
    'mot',
    'samsung',
    'htc',
    'sgh',
    'lg',
    'sharp',
    'sie-',
    'philips',
    'panasonic',
    'alcatel',
    'lenovo',
    'iphone',
    'ipod',
    'blackberry',
    'meizu',
    'android',
    'netfront',
    'symbian',
    'ucweb',
    'windowsce',
    'palm',
    'operamini',
    'operamobi',
    'openwave',
    'nexusone',
    'cldc',
    'midp',
    'wap',
    'mobile'
    );
    if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT'])))
    {
    return true;
    }
    }
    if (isset ($_SERVER['HTTP_ACCEPT']))
    {
    if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html'))))
    {
    return true;
    }
    }
    return false;
    }
  • 替换模板(  找到文件 /thinkphp/tpl/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 name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>跳转提示</title>
    <?php if(isMobile()==true){?>
    <style type="text/css">
    body, h1, h2, p,dl,dd,dt{margin: 0;padding: 0;font: 15px/1.5 微软雅黑,tahoma,arial;}
    body{background:#efefef;}
    h1, h2, h3, h4, h5, h6 {font-size: 100%;cursor:default;}
    ul, ol {list-style: none outside none;}
    a {text-decoration: none;color:#447BC4}
    a:hover {text-decoration: underline;}
    .ip-attack{width:100%; margin:200px auto 0;}
    .ip-attack dl{ background:#fff; padding:30px; border-radius:10px;border: 1px solid #CDCDCD;-webkit-box-shadow: 0 0 8px #CDCDCD;-moz-box-shadow: 0 0 8px #cdcdcd;box-shadow: 0 0 8px #CDCDCD;}
    .ip-attack dt{text-align:center;}
    .ip-attack dd{font-size:16px; color:#333; text-align:center;}
    .tips{text-align:center; font-size:14px; line-height:50px; color:#999;}
    </style>
    <?php }else{ ?>
    <style type="text/css">
    body, h1, h2, p,dl,dd,dt{margin: 0;padding: 0;font: 15px/1.5 微软雅黑,tahoma,arial;}
    body{background:#efefef;}
    h1, h2, h3, h4, h5, h6 {font-size: 100%;cursor:default;}
    ul, ol {list-style: none outside none;}
    a {text-decoration: none;color:#447BC4}
    a:hover {text-decoration: underline;}
    .ip-attack{width:600px; margin:200px auto 0;}
    .ip-attack dl{ background:#fff; padding:30px; border-radius:10px;border: 1px solid #CDCDCD;-webkit-box-shadow: 0 0 8px #CDCDCD;-moz-box-shadow: 0 0 8px #cdcdcd;box-shadow: 0 0 8px #CDCDCD;}
    .ip-attack dt{text-align:center;}
    .ip-attack dd{font-size:16px; color:#333; text-align:center;}
    .tips{text-align:center; font-size:14px; line-height:50px; color:#999;}
    </style>
    <?php }?> </head>
    <body>
    <div class="ip-attack"><dl>
    <?php switch ($code) {?>
    <?php case 1:?>
    <dt style="color: green"><?php echo(strip_tags($msg));?></dt>
    <?php break;?>
    <?php case 0:?>
    <dt style="color: red"><?php echo(strip_tags($msg));?></dt>
    <?php break;?>
    <?php } ?>
    <br>
    <dt>
    页面自动 <a id="href" href="<?php echo($url);?>">跳转</a> 等待时间: <b id="wait"><?php echo($wait);?></b>
    </dt></dl>
    </div>
    <script type="text/javascript">
    (function(){
    var wait = document.getElementById('wait'),
    href = document.getElementById('href').href;
    var interval = setInterval(function(){
    var time = --wait.innerHTML;
    if(time <= 0) {
    location.href = href;
    clearInterval(interval);
    };
    }, 1000);
    })();
    </script>
    </body>
    </html>

    over!over!over!

TP5之页面跳转样式的更多相关文章

  1. 【完美解决】vue,页面跳转样式错位但是刷新又好了的情况

    在vue文件中,做样式分离: 将覆盖样式单独写在一个style标签内,原页面写在 scoped样式作用域下.

  2. 页面跳转后样式丢失js失效

    2 页面跳转后样式丢失js失效 问题描述: 用ajax跳转的时候,从a.html跳转到b.html后,b.html的css以及js都失效了. 解决办法: 将当前页面需要用到的css以及js放在< ...

  3. jsp/servlet页面跳转丢失样式问题

    问题:使用servlet,如何处理在多路径页面跳转中servlet转发页面样式丢失问题?(例如访问 http://localhost/project/listUser.action后转到http:// ...

  4. request.getRequestDispatcher 页面跳转,样式丢失。

    在页面中引用样式和其它资源的时候,尽量不要用相对路径,因为"当前路径"这个概念在J2EE中是不稳定的. 所以最好都是绝对路径,类似于: <% String cp = requ ...

  5. thinkphp5(tp5)中success跳转页面和弹窗问题解决

    自己做了一个form页面,对其操作后,根据$this->success('提示信息',''),执行后是通过笑脸页面跳转,而不是在本页弹框后刷新.源码里带的原来的例子是弹出框刷新,为什么我自己做的 ...

  6. tp5页面跳转,空控制器空方法

    namespace app\index\controller; use think\Controller; class Login extends Controller{ //显示html页面 pub ...

  7. Controller中页面跳转完后页面的样式全消失的解决办法

    问题的原因应该是在controller中进行页面跳转时当前文件的路径变了 解决办法: 1.在jsp页面中<%@ page language="java" contentTyp ...

  8. jquerymobile页面跳转和参数传递

    http://blog.csdn.net/chen052210123/article/details/7481578 页面跳转: 页面跳转时pagebeforechange事件会被触发两次,通过$(d ...

  9. JQueryMobile页面跳转参数的传递解决方案

    在JQueryMobile开发手机端应用使用可能需要考虑相关的页面跳转带来的参数问题.因为JQueryMobile其实也是HTML5实践的结果.HTML5中有localStorage和sessionS ...

随机推荐

  1. 如何在微信小程序中使用字体图标

    微信小程序中,在image标签里,可以在src中引用本地文件,但是background设置背景图或者使用字体图标的时候,却不能引用本地文件,只能用url地址的图片或字体,或者使用base64编码后的格 ...

  2. spring boot Mybatis多数据源配置

    关于 有时候,随着业务的发展,项目关联的数据来源会变得越来越复杂,使用的数据库会比较分散,这个时候就会采用多数据源的方式来获取数据.另外,多数据源也有其他好处,例如分布式数据库的读写分离,集成多种数据 ...

  3. Drupal 初次使用感受,兴许补充。

    非常久曾经就接触过.下载下来安装,结果界面太丑,太难看,直接删除. 近期又一次想到开源CMS,好奇看到那么多人推崇drupal.也便下载来又一次研究了下. 刚接触了下.只是总体使用感觉非常差.尤其几个 ...

  4. 线程中调用Updatedata的问题

    随便发个自定义消息,然后在 CMyDialog的自定义消息处理函数中 UpdateDate().因为 UpdateDate用到了线程本地存储.不能跨线程的 UpdateData只能在主线程中使用,将U ...

  5. Windows消息、绘图与多线程

    有一个项目,一旦点下按钮后,用死循环不停的读数据,读出后立刻用可视化的方法显示.如果不采用多线程的方法,程序运行都正确,但无法关闭窗口,不清楚是窗口无法通过关闭按钮来接受Windows消息,还是接受了 ...

  6. VCL里的构造函数

    好奇,为什么Create函数明明是个构造函数,还要带上override;这是C++里没有的事情.我虽然也明白其大致的作用和目的,但还是没有见到官方和权威的说法.如果哪位大大见到此文,还望给一个详细一点 ...

  7. Visitor Pattern

    1.Visitor模式:将更新(变更)封装到一个类中(访问操作),并由待更改类提供一个接收接口,则可在不破坏类的前提下,为类提供增加新的新操作. 2.Visitor模式结构图 Visitor模式的关键 ...

  8. Block浅析一

    1.在Block结构体中含有isa指针,这就证明了Block其实就是对象,并具有一般对象的所有功能. 2.Block是OC中的一种数据类型,在iOS开发中被广泛使用. 3.block的应用 (1)遍历 ...

  9. js实现菜单二级联动

    代码如下,以便自己以后方便查阅: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> < ...

  10. jvm调试

    https://www.usenix.org/legacy/events/jvm01/full_papers/russell/russell_html/index.html