ios 自定义html页面发送到桌面图标

作者:matrix 发布时间:2020年6月26日星期五 分类:兼容并蓄 零零星星

经常用高德地铁图书签看地铁线路图
今天发现高德修改了scheme跳转规则,走到了测距界面。本来想重新设置个书签到桌面的,结果是找不到以前的方法了,干。

重新设置

高德地铁图url data数据

data:text/html;charset=UTF-8,%3Chtml%3E%20%20%20%20%20%20%20%20%3Chead%3E%20%20%20%20%20%20%20%20%3Cmeta%20content=%22yes%22%20name=%22apple-mobile-web-app-capable%22%20/%3E%20%20%20%20%20%20%20%20%3Cmeta%20content=%22text/html;%20charset=UTF-8%22%20http-equiv=%22Content-Type%22%20/%3E%20%20%20%20%20%20%20%20%3Cmeta%20name=%22viewport%22%20content=%22width=device-width,%20initial-scale=1.0,%20user-scalable=no%22%20%20%20%20%20%20%20%20/%3E%20%20%20%20%20%20%20%20%3Clink%20rel=%22apple-touch-icon-precomposed%22%20href=%22data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAABGdBTUEAALGPC/xhBQAAAwBQTFRFNqb25OPhlp1/wK1uqqR2bo+P17puW4iXRoCgM5zrMXipqNTxCWq5wtbjhr3jUK3ux69qoMbearXo+fn52eDmitabOa/VltyTSLbKtKhybL31ebnlYLz+q+aE5PT/dMT+1O3/7+/vUq7+fbz/tdPqeLv+Z6qowd3vobh5S6XA28VJAFqu3vH/+NhGipiDZ7G0o7mehbKvruiB5sl3V7j+oaF6T4Oc6thXosOKUKHFzsJUiaqdZIuUl8LgOaDcjbSrFG21bciwq8WEmrejfJBrPXyjv7N4crn+49ZchL3jRanwea+2HaHpTqzu0LZsY6rDD5f0fM+lxMGKr7yXTqXPK6jfNZzYa8D+OJG6YLHqeJKL18Z/LZ7jhJOCAFuvAGrDgJ+9HJv2m8zuU7P30OPuYbf1Wrb2zuHtutvvI3OvNaTzx9LW0dXV9PT0wtDYldL+E5v9h5ZngcPy19fTBZT77Orlis3+wub/ssvbm8f/KaH5u75kAGe/lr+Tg7GRL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IMdW2wIq8WeiIhYSEIp2nbPzL0WiA1Wij0GETFJgV+KJ87EvMUmsFQRnNaIiPmqK4rnTpcbwktihkPFHoGYV6m5oigum20Eb4gZlpzKzMyNcEVRnFWm614NxA4Hiz08dJjIGlHLnBl6TbbADriKUkqHhQ7TITEiek222g5YclJKhwYPUzdXt8kW88C67y0FliooHYxJhJCd0DOpm3q6r7s4wgE3FNBEzO/dBYCVz7rDF22CJScdkFdJskEnydv9kfB6u2CpYlAuyaagm/TjETcQx2yDGwbmZFMDGI5MatHgO122wdKQRGoIA6TWW9tiTliSGqqcPo/b1aErC7uVJptuKyxJUujKIM3ncbs6HD1gYcIeP2OM+Y/1Daz+/03zedwvXA4NFoRpNYyx4119C6vXNaESCIIgCMLhFjaln2Al/26PT0mZXLq3fmp/w0q64nAcjsNxOA7H4ThsEf4PNuWrmdAlCQ8AAAAASUVORK5CYII=%22%3E%20%20%20%20%20%20%20%20%3C/link%3E%20%20%20%20%20%20%20%20%3Ctitle%3E%20%20%20%20%20%20%20%20%E5%9C%B0%E9%93%81%E5%9B%BE%20%20%20%20%20%20%20%20%3C/title%3E%20%20%20%20%20%20%20%20%3Cstyle%3E%20%20%20%20%20%20%20%20%20%20%20%20*%7Bmargin:0;padding:0%7D%20%20%20%20%20%20%20%20%20%20%20%20html,body%7Bheight:100%25;min-height:100%25%7D%20%20%20%20%20%20%20%20%20%20%20%20body%7Bbackground:%23eee;text-align:center;overflow:hidden%7D%20%20%20%20%20%20%20%20%20%20%20%20a%7Bdisplay:%20none%7D%20%20%20%20%20%20%20%20%20%20%20%20p%7Bfont-size:14px;line-height:200%25%7D%20%20%20%20%20%20%20%20%20%20%20%20.logo%7Bwidth:90px;margin-top:%2032px%7D%20%20%20%20%20%20%20%20%20%20%20%20section%7Bwidth:%20264px;height:%2078px;background:%23fff;position:absolute;bottom:%2020px;-webkit-border-radius:%203px;border-radius:%203px%7D%20%20%20%20%20%20%20%20%20%20%20%20section:before%7Bcontent:'';display:block;width:528px;height:156px;-webkit-transform:scale(0.5);-webkit-transform-origin:%20left%20top;border:1px%20solid%20%2389ccff;-webkit-border-radius:6px;border-radius:%206px;z-index:1%7D%20%20%20%20%20%20%20%20%20%20%20%20section:after%7Bcontent:'';display:block;width:36px;height:%2036px;border:%201px%20solid%20%2389ccff;background:%20%23fff;position:absolute;-webkit-transform:%20scale(0.5)%20rotate(45deg);bottom:%20-19px;left:113px;z-index:%202%7D%20%20%20%20%20%20%20%20%20%20%20%20div%7Bposition:%20absolute;top:%201px;right:%201px;bottom:0;left:1px;z-index:3;background:%23fff%7D%20%20%20%20%20%20%20%20%20%20%20%20div%20%3E%20p%7Bcolor:%20%23333%7D%20%20%20%20%20%20%20%20%20%20%20%20div%20%3E%20p:first-child%7Bmargin-top:8px%7D%20%20%20%20%20%20%20%20%20%20%20%20span%7Bdisplay:inline-block;width:%2017px;height:%2023px;background:%20url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAuCAMAAACRbICIAAABR1BMVEX///9+wv8UkP9ktv/j8v/S6v8lmf/Y7f90vv8Rj/8pl//s+P+a1P8smv8mmf/t+P+54/+Y0/+Z1P/q9/8Eif9fuP9Ssf9Usv/j8f/P6/8mlv8Dgv+Z0//p9/9Ssv9ovP/0/P/Z7f9TsP8qmv8Hgv/t+f9XtP/5/f/k9P/T7//9/v8IhP+k2f+W0f92w//4/v/U8P9Pr//X7f9Ep/9Vsf8pkf/y+f+m1f8pmv8qm/8tk/+Vzf8Sj//x+P+c0P8Rhf8Mjf96wP9PsP/X7P/9///8/v+IyP9nuP/U6//K5v+ey//w+P/W7P8VkP8hl/9zvv+73/8LjP/P7f90vf91vv9ktf9zwP9ksP+x2v8Ae/8Ag/8Ad/8AfP8Adv9it/8Ahv8LjP90wf8AhP8Ji/8Aev8AgP8Acv8Adf8Aav8imf+a0/8Tiv8AiP/+x5cfAAAAWXRSTlMAgeubHCzZJovt1RJk09kSRmZmFPufrascMNn7Zhatlwomq9X3EqcGGiwC91poiQYqryi7qdUMWNXV0WrtDmLt84WvKAICdpcqNGAOKOndi0TzMIuJm4ubTn6oYBsAAADXSURBVHhe7c1FVwNBEIXRNxODhIm7E0IUdXd3lx6JB///a1h0b2CoJbDIt3znnip8qeStgMwVfhulQaSrBpME8Myo7Xrj3ffzhZzerLHXl5Yf5gW2WGhHMqKxeGLAFKTSeiaLc20QV868GRkusLsi0Kc5gLJSHfkudvfGxsEFJianYBoXvN8V08qCaGiOi/lZMS0uLUNW+0Urq1ysrYtpQ9uE7Ka+bD9JkO2UsP0P0RP7zwe0wOHRMSlEfy96wk2Jk09xemYlujAkXLIOEXu8xs2ther+4QN2Dj6s1Wm3NwAAAABJRU5ErkJggg==)%20no-repeat%20center;background-size:%20contain;margin:%200%2010px;position:relative;top:3px%7D%20%20%20%20%20%20%20%20%3C/style%3E%20%20%20%20%20%20%20%20%3C/head%3E%20%20%20%20%20%20%20%20%3Cbody%3E%20%20%20%20%20%20%20%20%3Ca%20href=%22iosamap://openFeature?featureName=Subway&sourceApplication=applicationName&page=Subway%22%20id=%22qbt%22%3E%3C/a%3E%20%20%20%20%20%20%20%20%3Cnav%20id=%22nav%22%3E%3C/nav%3E%20%20%20%20%20%20%20%20%3C/body%3E%20%20%20%20%20%20%20%20%3Cscript%3E%20%20%20%20%20%20%20%20if%20(window.navigator.standalone%20==%20true)%20%7B%20%20%20%20%20%20%20%20%20%20%20%20var%20lnk%20=%20document.getElementById(%22qbt%22);%20%20%20%20%20%20%20%20%20%20%20%20var%20evt%20=%20document.createEvent('MouseEvent');%20%20%20%20%20%20%20%20%20%20%20%20evt.initMouseEvent('click');%20%20%20%20%20%20%20%20%20%20%20%20lnk.dispatchEvent(evt);%20%20%20%20%20%20%20%20%7D%20else%20%7B%20%20%20%20%20%20%20%20%20%20%20%20var%20bodyWidth%20=%20document.body.clientWidth;%20%20%20%20%20%20%20%20%20%20%20%20var%20nav%20=%20document.getElementById(%22nav%22);%20%20%20%20%20%20%20%20%20%20%20%20nav.innerHTML%20=%20'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+%20'px%22%3E'%20+%20'%3Cdiv%3E'%20+%20'%3Cp%3E%E7%82%B9%E5%87%BB%E9%A1%B5%E9%9D%A2%E4%B8%8B%E6%96%B9%3Cspan%3E%3C/span%3E%E6%8C%89%E9%92%AE%3C/p%3E'%20+%20'%3Cp%3E%E5%9C%A8%E5%BC%B9%E5%87%BA%E8%8F%9C%E5%8D%95%E9%80%89%E6%8B%A9%E2%80%9C%E6%B7%BB%E5%8A%A0%E5%88%B0%E4%B8%BB%E5%B1%8F%E5%B9%95%E2%80%9D%3C/p%3E'%20+%20'%3C/div%3E'%20+%20'%3C/section%3E';%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20%3C/script%3E%20%20%20%20%20%20%20%20%3C/html%3E

说明:

其中核心位置为 iosamap://scheme a标签跳转。

iosamap://openFeature?featureName=Subway&sourceApplication=applicationName&page=Subway

顺便再记录下官方原版不可用的scheme:

iosamap://openFeature?featureName=Mine&page=ToolBox&item=Subway

item参数失效,所以就默认跳转到了测距界面。

使用

复制顶部的url data代码,在safair地址栏中打开,使用下方的分享发送按钮发送到桌面快捷键即可。

到这里就解决了问题。
下面是简化和修改操作,各位没必要看了。

自定义以及精简

上面的大段官方代码主要是css样式、图标等信息,其实可直接简化。

代码中可以任意修改。设置为其他任意界面,样式,图标,标题,以及打开的跳转页面和预览窗口都可以。要求为data:text/html形式。

如果理解一些html,可简化html为如下形式:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.location.href = 'iosamap://openFeature?featureName=Subway&sourceApplication=applicationName&page=Subway';
    </script>
</head>
<body>
</body>
</html>

最终的url data数据:

data:text/html;charset=UTF-8,%3c!DOCTYPE%20html%3e%0d%0a%3chtml%20lang%3d%22en%22%3e%0d%0a%3chead%3e%0d%0a%20%20%20%20%3cmeta%20charset%3d%22UTF-8%22%3e%0d%0a%20%20%20%20%3ctitle%3eTitle%3c%2ftitle%3e%0d%0a%20%20%20%20%3cscript%20%3e%0d%0awindow.location.href%20%3d%20%27iosamap%3a%2f%2fopenFeature%3ffeatureName%3dSubway%26sourceApplication%3dapplicationName%26page%3dSubway%27%3b%0d%0a%20%20%20%20%3c%2fscript%3e%0d%0a%3c%2fhead%3e%0d%0a%3cbody%3e%0d%0a%3c%2fbody%3e%0d%0a%3c%2fhtml%3e

说明:

注意!需要以data:text/html;charset=UTF-8,形式开头。切记,后面字符全部为url编码数据,空格字符编码为%20,非+字符。

schma参考:

https://lbs.amap.com/api/amap-mobile/guide/ios/subway

ISO8601时间字符串到时间戳处理

作者:matrix 发布时间:2019年6月21日星期五 分类:Python 兼容并蓄

之前不太理解ISO8601时间格式,后来看了下网上文章,其实是没有固定的单一格式。
按照下面这些其实都属于ISO8601时间格式:

2019-03-25T16:00:00.000111Z
2019-03-25T16:00:00.111Z
2019-03-25T16:00:00Z
2019-03-25T16:00:00
...

Z表示祖鲁时间Zulu time+0时区,若去掉不写Z则采用系统本地时区。
ISO8601时间还有很多其他扩展格式。

下面代码处理的也就是普通格式

python

import datetime,pytz
def iso2timestamp(datestring, format='%Y-%m-%dT%H:%M:%S.%fZ',timespec='seconds'):
    """
    ISO8601时间转换为时间戳

    :param datestring:iso时间字符串 2019-03-25T16:00:00.000Z,2019-03-25T16:00:00.000111Z
    :param format:%Y-%m-%dT%H:%M:%S.%fZ;其中%f 表示毫秒或者微秒
    :param timespec:返回时间戳最小单位 seconds 秒,milliseconds 毫秒,microseconds 微秒
    :return:时间戳 默认单位秒
    """
    tz = pytz.timezone('Asia/Shanghai')
    utc_time = datetime.datetime.strptime(datestring, format)  # 将字符串读取为 时间 class datetime.datetime

    time = utc_time.replace(tzinfo=pytz.utc).astimezone(tz)

    times = {
        'seconds': int(time.timestamp()),
        'milliseconds': round(time.timestamp() * 1000),
        'microseconds': round(time.timestamp() * 1000 * 1000),
    }
    return times[timespec]


def timestamp2iso(timestamp, format='%Y-%m-%dT%H:%M:%S.%fZ'):
    """
    时间戳转换到ISO8601标准时间(支持微秒级输出 YYYY-MM-DD HH:MM:SS.mmmmmm)
    :param timestamp:时间戳,支持 秒,毫秒,微秒级别
    :param format:输出的时间格式  默认 iso=%Y-%m-%dT%H:%M:%S.%fZ;其中%f表示微秒6位长度

    此函数特殊处理,毫秒/微秒部分 让其支持该部分的字符格式输出
    :return:
    """
    format = format.replace('%f','{-FF-}')#订单处理微秒数据 %f
    length = min(16, len(str(timestamp)))#最多去到微秒级

    #获取毫秒/微秒 数据
    sec = '0'
    if length != 10:#非秒级
        sec = str(timestamp)[:16][-(length - 10):]#最长截取16位长度 再取最后毫秒/微秒数据
    sec = '{:0<6}'.format(sec)#长度位6,靠左剩下的用0补齐
    timestamp = float(str(timestamp)[:10])#转换为秒级时间戳
    return datetime.datetime.utcfromtimestamp(timestamp).strftime(format).replace('{-FF-}',sec)

说明:
之前别个写的iso到时间戳的转换方法简直蛋疼,无参数说明和无法精确到秒级别。
两个函数都可以相互转换和处理。

参考:

https://en.wikipedia.org/wiki/ISO_8601
https://docs.Python.org/zh-cn/3.7/library/datetime.html?highlight=isoformat#strftime-strptime-behavior
https://www.w3.org/TR/NOTE-datetime
https://www.cryptosys.net/pki/manpki/pki_iso8601datetime.html

ubuntu安装Let’s Encrypt证书实测

作者:matrix 发布时间:2017年1月15日星期日 分类:兼容并蓄 零零星星

Let’s Encrypt证书出来已经有很长时间,之前用主机未到期,也就干瞪眼。
现在手上拿了一台有设备,其实算下来价格也都差不多,国外的速度是慢点,但是好处很多。

测试环境:
ubuntu 14 64bit
lnmp 1.3

获取证书

git clone https://github.com/letsencrypt/letsencrypt 
cd letsencrypt
./letsencrypt-auto certonly --standalone --email hhtjim@foxmail.com -d hhtjim.com -d www.hhtjim.com
# 若服务器已经占用80端口开启webserver则只需执行webroot:
#  ./letsencrypt-auto certonly --webroot --email hhtjim@foxmail.com -d link.hhtjim.com

执行完上面三个命令之后会有图形界面出现
gui图形界面
选择Agree之后出现这个也就完成了证书的获取

安装证书

修改域名对应下的nginx配置
进入/usr/local/nginx/conf/vhost目录找到和域名同名的conf文件
在server代码块中添加:

listen 443 ssl;
        #listen [::]:80;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/域名/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/域名/privkey.pem;

参考如下完整配置

server
    {
        listen 80;
        listen 443 ssl;
        #listen [::]:80;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/hhtjim.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/hhtjim.com/privkey.pem;

        server_name hhtjim.com www.hhtjim.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/hhtjim.com;

        include other.conf;
        #error_page   404   /404.html;
        include enable-php.conf;
        include wordpress.conf;

                if ($http_host !~ "^www.hhtjim.com$"){
                    rewrite  ^(.*)    https://www.hhtjim.com$1 permanent;
                }
                if ($scheme = "http"){ 
                        rewrite ^(.*)$  https://$host$1 permanent;
                }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/hhtjim.com.log;
    }

接着准备重启nginx:lnmp nginx restart

参考:loazuo

更新操作

按照网上大多执行的命令我这里就会出现交互界面,需要手动选择webroot目录

How would you like to authenticate with the ACME CA? 

       x x          1  Place files in webroot directory (webroot)           x x  
       x x          2  Spin up a temporary webserver (standalone)  


还好找到办法,只需要添加参数 --webroot -w 设置好存放web路径即可。最终参考如下

ubuntu下保存为sh文件。记得附加x执行权限。然后执行该sh文件即可自动更新证书.

#!/bin/sh
~/letsencrypt/letsencrypt-auto certonly --webroot -w /home/wwwroot/www.hhtjim.com/ --renew-by-default --email hhtjim@foxmail.com -d hhtjim.com -d www.hhtjim.com && lnmp nginx restart

若报错Failed authorization procedure...则需要修改-w参数为网站根目录
如:

-w /home/wwwroot/hhtjim.com/

且nginx配置中将.well-known加入白名单:

location ~ /.well-known {
            allow all;
    }

参考:
http://letsencrypt.readthedocs.io/en/latest/using.html
https://www.ubock.com/article/25
https://stackoverflow.com/questions/42269107/using-certbot-to-apply-lets-encrypt-certificate-failed-authorization-procedure

最后的定时执行

修改定时任务 crontab -e
0 0 1 * * /root/updateLetsEncrypt.sh #每月1号执行sh脚本

重启定时服务 /etc/init.d/cron restart

peace

Let’s Encrypt 项目提供免费的SSl证书

作者:matrix 发布时间:2015年9月15日星期二 分类:兼容并蓄 零零星星

官网:https://letsencrypt.org
github: https://github.com/letsencrypt/letsencrypt
letsencrypt

这将表示如果一个网站只是需要最基本的HTTPS加密,那么将无需任何花费购买SSL证书。

Mozilla、思科、Akamai、IdenTrust、EFF 和密歇根大学研究人员宣布了 Let’s Encrypt CA项目,计划为网站提供免费 ssl 证书,加速将 Web 从 HTTP 过渡到 https

上个月才看到了这个消息,大咖阵容提供的公益项目。之前说好的9月份发布,怎么又推迟到了Q4 2015。
网站使用https协议非常不错 。至少比普通网站多了一个绿色的标识,好看还安全~不容易被『挤挨服达不溜』监听到通讯内容。
BUT网站使用https协议必须要有ssl证书,大多都是收费的。不过目前也有免费的,沃通、CloudFlare。。。。。

沃通这些没用过,看到有这么好的公益项目那当然是首推!!值得等待。

Postscript:百度在前几个月都默默启用了全站SSL

阅读剩余部分 »

正确OpenWeiPN GUI上网姿势

作者:matrix 发布时间:2015年6月23日星期二 分类:兼容并蓄

使用WeiPN Gate Client高科技上网的时候发现还有OpenVPN配置文件这种东东。没明白怎么用就查了查。原来还有个比较不错的上网选择,使用OpenWeiPN GUI。

OpenWeiPN GUI下载

官网http://openvpn.net/index.php/open-source/downloads.html
百度网盘http://pan.baidu.com/s/1FbrzC

使用

1.安装完成OpenWeiPN
2.找到软件安装目录下的config文件夹
README.txt
This directory should contain OpenVPN configuration files
each having an extension of .ovpn

When OpenVPN is started as a service, a separate OpenVPN
process will be instantiated for each configuration file.
意思就是喊你把.ovpn文件放置在此目录(config文件夹)

3.获取.ovpn文件
如果你有的话那就好,没有就请选择合适的上网地点:http://130.158.6.78/cn/
下载其对应的配置文件(.ovpn文件)到config文件夹。

4.打开软件OpenWeiPN GUI,最好请使用管理员权限运行
5.右键点击软件托盘图标选择好你的配置文件然后点击connect
右键点击软件托盘图标

怕是以后地址被qiang了,可以现在订阅他们的邮件。
http://130.158.6.78/cn/mail.aspx

参考:http://130.158.6.78/cn/howto_openvpn.aspx

PHP递归函数内的静态变量

作者:matrix 发布时间:2015年6月20日星期六 分类:兼容并蓄 零零星星

//静态变量的例子

/**
 * 将数组转换为字符
 *
 * 用于缓存
 *
 * @param $data
 * @return string
 */
function philnaArray2String($data, $returns = '')
{
    static $t = 1;
    $tabType = " ";
    $tab = str_repeat($tabType, $t);
    $data = (array)$data;
    foreach ($data as $key => $value) {
        if (is_array($value)) {
            $t++;
            $returns .= "$tab'" . $key . "' => array(\n" . philnaArray2String($value) . "$tab),\n";
        } else {
            if (!is_bool($value)) {
                $value = "'" . addslashes($value) . "'";
            }
            $returns .= "$tab'" . $key . "' => $value,\n";
        }
    }
    $returns = substr_replace($returns, '', -2, -1);
    return $returns;
}

说明:
上面php代码中的$t被static修饰,即为静态变量
静态变量在函数执行完毕后不会释放,会继续累加下去
赶脚非常合适在递归函数中用

参考:http://blog.csdn.net/shaerdong/article/details/8545874

win和linux的php异或运算结果不同

作者:matrix 发布时间:2015年6月17日星期三 分类:兼容并蓄 零零星星

一个获取key的函数(模拟js的php代码)在本地测试成功,而在服务器上失败。
逐行die()之后发现问题在于$b ^=4294967295;之前获取的$b都没问题,可到了这里就结果完全不一样。

win

<?php
$a = -38622 72608;
$b = 471468;
$c = $a ^ $b;
echo $c;
//Q1:
//本地这是5.2.14的php,Win,显示432886796;
//服务器上5.2.14的php,linux,显示-3862080500;
//Q2:如果将^ 换成xor
//本地显示-3862272608
//服务器显示-3862272608
?>

真是狗日的xor仙人板板。为什么换成xor结果和^又不同。
难道xor不是异或。。。 😕

Q1:幸好我不是第一个发现。算是有答案:
php中一个整数能表示的范围是2147483647~-2147483647
在linux环境下,php整数溢出的时候,其结果是不可靠
php提供了GMP库进行精确计算大数据
如果你的php开启了GMP:gmp_xor()进行xor运算

Q2:无解
将^ 换成xor运算win和linux的结果都一样。但是为毛线它又和^的结果不同。。。
应该也是整数溢出吧。。。懒得想了

参考:
php异或运算的不可靠性
http://php.net/manual/zh/ref.gmp.php
http://bbs.csdn.net/topics/390566090

将BCS的bucket文件保存到本地[PHP]

作者:matrix 发布时间:2015年6月3日星期三 分类:兼容并蓄 零零星星

收到百度BCS 6月30日停服提醒邮件,说是要停止服务,请自重。让咱BCS迁移到BOS...

BCS的bucket是以前创建bae时设置的,保存了一些图片文件

怎样把云存储的文件备份到本地是一个问题啊。毕竟一个一个下载太麻烦,文件有些多。。。

BCS控制台:http://developer.baidu.com/console#app/project

打开BCS控制台可以查看你的bucket名称以及API Key 和Secret Key。如果里面的文件有点多,且你想保存下来

下载 :http://pan.baidu.com/s/1mgMhp92

使用说明:

请确保解压后有个空的TTSEE文件夹,它用来存放下载的文件

只能保存一个bucket里面的文件,bucket有多层文件夹应该(我没试过)能正常使用的。

//$bcsobj->list_object_by_dir($bucket,'/',$list_model = 2);

解压后配置好bcs/conf-inc.php参数:项目对应的AK 公钥和SK私钥(百度开发者中心里复制)

调用:127.0.0.1/download.php?bucket=bucket名称

php中用到了file_put_contents函数:

$file = file_get_contents('http://bcs.duapp.com/newbuck'.$objest);//读取远程文件
file_put_contents('TTSEE'.$objest,$file);//保存到同级TTSEE目录

参考:

http://www.cnblogs.com/m199/p/3450675.html

http://www.jb51.net/article/57127.htm

PS:
150710后续更新
把bcs文件下载到本地电脑后再上传到主机空间。
之后用sql语法批量替换旧url。

UPDATE wp_posts 
SET post_content = ( Replace (post_content, 'bcs.duapp.com/newbuck/', 'www.hhtjim.com/wp-content/uploads/2015/bcsfile/') )
WHERE Instr(post_content, 'jpeg') > 0 
 OR Instr(post_content, 'jpg') > 0 
 OR Instr(post_content, 'gif') > 0 
 OR Instr(post_content, 'png') > 0

参考:
https://free.com.tw/moving-to-https-on-wordpress/