至尊技术网 - 跳转 2021-09-04T18:27:00+08:00 Typecho https://www.zzwws.cn/feed/atom/tag/%E8%B7%B3%E8%BD%AC/ <![CDATA[简单通用微信QQ跳转浏览器打开代码]]> https://www.zzwws.cn/archives/5710/ 2021-09-04T18:27:00+08:00 2021-09-04T18:27:00+08:00 悠悠楠杉 http://www.zzwws.cn

使用方法

放到head.php,没有的话放到index.php,网站最顶部

使用说明

手机QQ内打开,会自动跳转浏览器;

微信内打开,需用用户手动跳转;

用户可选择对应浏览器;

用户可手动复制网站地址;

<?php
if(strpos($_SERVER['HTTP_USER_AGENT'], 'QQ/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false){
    $siteurl='http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];echo '<html>
<head>
    <meta charset="UTF-8">
    <title>使用浏览器打开</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta name="format-detection" content="telephone=no">
    <meta content="false" name="twcClient" id="twcClient">
    <meta name="aplus-touch" content="1">
    <style>
        body,html{width:100%;height:100%}
        *{margin:0;padding:0}
        body{background-color:#fff}
        #browser img{
            width:50px;
        }
        #browser{
            margin: 0px 10px;
            text-align:center;
        }
        #contens{
            font-weight: bold;
            margin:-285px 0px 10px;
            text-align:center;
            font-size:20px;
            margin-bottom: 125px;
        }
        .top-bar-guidance{font-size:15px;color:#fff;height:70%;line-height:1.8;padding-left:20px;padding-top:20px;background:url(//gw.alicdn.com/tfs/TB1eSZaNFXXXXb.XXXXXXXXXXXX-750-234.png) center top/contain no-repeat}
        .top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}
        .app-download-tip{margin:0 auto;width:290px;text-align:center;font-size:15px;color:#2466f4;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcAQMAAACak0ePAAAABlBMVEUAAAAdYfh+GakkAAAAAXRSTlMAQObYZgAAAA5JREFUCNdjwA8acEkAAAy4AIE4hQq/AAAAAElFTkSuQmCC) left center/auto 15px repeat-x}
        .app-download-tip .guidance-desc{background-color:#fff;padding:0 5px}
        .app-download-btn{display:block;width:214px;height:40px;line-height:40px;margin:18px auto 0 auto;text-align:center;font-size:18px;color:#2466f4;border-radius:20px;border:.5px #2466f4 solid;text-decoration:none}
    </style>
</head>
<body>
<div class="top-bar-guidance">
    <p>点击右上角<img src="//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class="icon-safari"> <span id="openm">Safari打开</span></p>
    <p>可以继续浏览本站哦~</p>
</div>
<a style="display: none;" href="" id="vurl" rel="noreferrer"></a>
<div id="contens">
1.防止腾讯屏蔽本站链接<br /><br />
2.建议用QQ浏览器打开效果最佳<br /><br />
3.您也可以百度搜索关键字:至尊技术网<br />
</div>
<div id="browser">
    <a href="mttbrowser://url='. $siteurl .'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1s0o0j3074074t9r.jpg"></img></a>
    <a href="googlechrome://browse?url='. $siteurl .'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1zpavj3074074tax.jpg"></img></a>
    <a href="alipays://platformapi/startapp?appId=20000067&url='. $siteurl .'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1rqdbj3074074gmp.jpg"></img></a>
    <a href="googlechrome://browse?url='. $siteurl .'"><img src="http://wx2.sinaimg.cn/mw690/0060lm7Tly1g019l1rjw5j3074074dfy.jpg"></img></a>
    <a href="ucbrowser://'. $siteurl .'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1snd3j3074074gnv.jpg"></img></a>
    <a href="bdbrowser://'. $siteurl .'"><img src="http://wx1.sinaimg.cn/mw690/0060lm7Tly1g019v4k8vkj307407440t.jpg"></img></a>
</div>
<div class="app-download-tip">
    <span class="guidance-desc">点击上方图标or复制本站网址自行打开</span>
</div>
 <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
 <script src="https://cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.8/clipboard.min.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/layer/3.5.1/layer.min.js"></script>
<a data-clipboard-text="'.$siteurl.'" class="app-download-btn">点此复制本站网址</a>
<script type="text/javascript">
  new ClipboardJS(".app-download-btn");
  $(".app-download-btn").click(function() {
layer.tips("复制成功,么么哒", ".app-download-btn", {
  tips: [3, "rgb(38,111,250)"],
  time:500
});})
</script>
<script>
function openu(u){
document.getElementById("vurl").href= u;
document.getElementById("vurl").click();
}
var url = window.location.href;
    if(navigator.userAgent.indexOf("QQ/")> -1){
        openu("ucbrowser://"+url);
        openu("mttbrowser://url="+url);
        openu("baiduboxapp://browse?url="+url);
        openu("googlechrome://browse?url="+url);
        openu("mibrowser:"+url);
        openu("taobao://"+url.split("://")[1]);
        openu("alipays://platformapi/startapp?appId=20000067&url="+url);
        $("html").on("click",function(){
            openu("ucbrowser://"+url);
            openu("mttbrowser://url="+url);
            openu("baiduboxapp://browse?url="+url);
            openu("googlechrome://browse?url="+url);
            openu("mibrowser:"+url);
            openu("taobao://"+url.split("://")[1]);
            openu("alipays://platformapi/startapp?appId=20000067&url="+url);
        });
    }else if(navigator.userAgent.indexOf("MicroMessenger") > -1){
        if(navigator.userAgent.indexOf("Android") > -1){
            var iframe = document.createElement("iframe");
            iframe.style.display = "none";
            document.body.appendChild(iframe);
        }else{
             
        }
    }
</script>
</html>';exit; 
}?>
]]>
<![CDATA[PHP分页类库,支持ajax模式和普通的跳转模式,内含demo例子]]> https://www.zzwws.cn/archives/4936/ 2020-11-11T15:38:00+08:00 2020-11-11T15:38:00+08:00 悠悠楠杉 http://www.zzwws.cn 介绍:

没有任何依赖,可在任何环境下使用,开箱即用 简单灵活好用,多个样式可选,支持 ajax 模式 和 普通的跳转模式,如:[?|&]page=1 和 pathInfo /page/1 等模式
点击跳转分页时不会漏掉其他url原有的参数

安装:

方式1:使用 composer 命令安装:composer require tcwei/page 方式2:也可直接在 src找到 Page.php 类库文件,直接拖到你的类目录内,include 该文件可直接使用

使用:

简单使用:

include 'Page.php';
use tcwei\smallTools\Page;
$pageClass = new Page(); 
$totle = 100;//总条数
$pageHtml = $pageClass->getPageHtml($totle);
echo $pageHtml;

例子1 pathInfo模式:

$pageClass = new Page();
//选择分页样式: 可选用样式:flickr、blackRed、youtube、viciao
$pageClass->pageType = 'flickr';
//分页位置,如:左、中、右;可不设置,使用默认位置
$pageClass->pageAlign = 'center';
//鼠标移动到按钮时按钮的背景颜色设置,可不设置使用默认值
$pageClass->hoverBgColor = '#00a0e9';
//鼠标移动到按钮时按钮的页码数字颜色设置,可不设置使用默认值
$pageClass->hoverFontColor = '#fff';
//当前页码的字体颜色
$pageClass->nowPageFontColor = '#ff0084';
$totle = 100; 
//第2个参数是每页显示多少条数据,第3个参数是显示多少个分页按钮,第4个参数是显示...和最后一个页码
$pageHtml = $pageClass->getPageHtml($totle, 10, 7, true);

例子2 ajax 模式:请到 demo-ajax 中查看完整示例

include "../vendor/autoload.php";
use tcwei\smallTools\Page;
$pageClass = new Page();
//开启 ajax 模式
$pageClass->isAajx = true;
//前端进行ajax分页请求数据的函数名,需要前端定义该函数; 要在 ajax 的回调内执行 pageAjaxLock = true; 进行解锁,解锁后才能进行下一次ajax分页触发,这是防止用户多次重复点击
$pageClass->ajaxFunctionName = 'getList()';
//假设有100列数据
$totle = 100;
$pageHtml = $pageClass->getPageHtml($totle);

参数介绍:

$pageClass->autoAddUrlInfo

默认为3 是否开启自动补全路由信息,仅在 pathInfo 模式下有效,即自动补全路由参数
不足3个的在后面自动追加index,如:/admin/index 跳转页码时会自动变成
/admin/index/index/page/X 会多添加一个/index补全3个路由参数 如果不需要自动补全传入0;

$pageClass->requestUri

如果是 swoole 启动的服务,需要传入$pageClass->requestUri = $request->server['request_uri'] ,不是swoole直接忽略该参数

$pageClass->isAjax

是否开启ajax模式,默认为false

$pageClass->urlType

默认是0 设置URL的类型,是 pathInfo 模式,即 .../page/X
设置为1为普通模式,page是$_GET获取,即 ?page=X 或 &page=X

$pageClass->pageType

默认 flickr
分页样式选择,可选样式:flickr、blackRed、youtube、viciao
也可以自定义样式,如:$pageClass->pageType = 'myStyle';
前端写样式:
.tcweiPageMain .myStyle{}//分页main样式
.tcweiPageMain .myStyle a{}//跳转按钮样式
.tcweiPageMain .myStyle a:hover{}//鼠标移到按钮时的样式
.tcweiPageMain .myStyle span.current{}//当前页码的样式
.tcweiPageMain .myStyle a:active{}//点击按钮时的样式
.tcweiPageMain .myStyle span.disabled{}//不可点击的按钮样式

$pageClass->pageAlign

每个样式的默认位置不一样
分页组件的位置,可选:left 、 center 、 right

$pageClass->hoverBgColor

鼠标移动到按钮时按钮的背景颜色设置,可不设置使用默认值

$pageClass->hoverFontColor

鼠标移动到按钮时按钮的页码数字颜色设置,可不设置使用默认值

$pageClass->nowPageFontColor

当前页码的字体颜色

$pageClass->getPageHtml() 共有9个参数

getPageHtml($totle, $onePageDisplayNum = 10, $showNumList = 7, $showNumListType = true, $showText = false, $showPrevNext = true, $showHome = true, $showSelect = false, $url = null)
1)$totle int 传入数据的总条数
2)$onePageDisplayNum int 每页显示条数
3)$showNumList int 数字页码按钮显示几个
4)$showNumListType bool 决定 $showNumList 的模式,true时,会在 $showNumList 后面显示...尾页按钮,默认显示
5)$showText bool 是否显示行数页数等文字信息,默认不显示,如上面说的 “1-10/100 记录” 这个数据显示
6)$showPrevNext bool 是否显示 上一页、下一页 俩个按钮,默认显示
7)$showHome bool 是否显示 首页、尾页 俩个按钮,默认显示
8)$showSelect bool 是否显示下拉选择页码的部分,默认不显示
9)$url string 传入自定义跳转的url,如传入: https://www.baidu.com?page=  或者 https://www.baidu.com/page/ 后面的页码会自动添加

github:https://github.com/ITzhiwei/page

下载地址:https://zhizun.lanzoux.com/i2Cg2ia9b3g

]]>