2019年7月

apache同时配置80和443端口 the first has precedence, perhaps you need a NameVirtualHost directive

同时添加:
NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:443>
    DocumentRoot "/www/hitortoise"
    ServerName www.r1989.com

    SSLEngine on
    SSLCertificateFile /www/ssl/2_www.r1989.com.crt
    SSLCertificateKeyFile /www/ssl/3_www.r1989.com.key
    SSLCertificateChainFile /www/ssl/1_root_bundle.crt
</VirtualHost>

<VirtualHost *:80>
     DocumentRoot "/www/hitortoise"
     ServerName www.r1989.com

     RewriteEngine on
     RewriteCond %{HTTP_HOST} ^www.r1989.com$
     RewriteRule ^/(.*)$ https://www.r1989.com/$1 [R=301,L]
</VirtualHost>

phpword添加批注注释信息

$phpWord = \PhpOffice\PhpWord\IOFactory::load("/test/test1.docx");

//创建注释
$comment= new \PhpOffice\PhpWord\Element\Comment('森森', new \DateTime(), 'my_initials');
$comment->addText('这是批注的信息内容', array('bold' => false, 'color'=>'ff0000'));

//添加到注释
$phpWord->addComment($comment);

$section = $phpWord->getSection(0);

//创建文本并添加注释
$textrun = $section->addTextRun();
$textrun->addText('这里需要进行');
$text = $textrun->addText('注释');
//将注释链接到刚创建的文本上
$text->setCommentRangeStart($comment);
//也可以为注释设置起始位置
//$comment->setStartElement($text);

//原始文本添加注释

//导出注释版
$phpWord->save("/test/test2.docx");

1111.png

localStorage设置过期时间

//设置localStorage
function setLocalStorage(key, value) {
    var curtime = new Date().getTime(); // 获取当前时间 ,转换成JSON字符串序列
    var valueDate = JSON.stringify({
        val: value,
        timer: curtime
    });
    try {
        localStorage.setItem(key, valueDate);
    } catch(e) {
        // 兼容性写法
        if(isQuotaExceeded(e)) {
            console.log("Error: 本地存储超过限制");
            localStorage.clear();
        } else {
            console.log("Error: 保存到本地存储失败");
        }
    }
}

function isQuotaExceeded(e) {
    var quotaExceeded = false;
    if(e) {
        if(e.code) {
            switch(e.code) {
                case 22:
                    quotaExceeded = true;
                    break;
                case 1014: // Firefox
                    if(e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
                        quotaExceeded = true;
                    }
                    break;
            }
        } else if(e.number === -2147024882) { // IE8
            quotaExceeded = true;
        }
    }
    return quotaExceeded;
}

//获取localStorage
function getLocalStorage(key, day=1) {
    var exp = 60 * 60 * day; // 一天的秒数
    exp = exp*1000;
    if(localStorage.getItem(key)) {
        var vals = localStorage.getItem(key); // 获取本地存储的值
        var dataObj = JSON.parse(vals); // 将字符串转换成JSON对象
        // 如果(当前时间 - 存储的元素在创建时候设置的时间) > 过期时间
        var isTimed = (new Date().getTime() - dataObj.timer) > exp;
        if(isTimed) {
            console.log("存储已过期");
            localStorage.removeItem(key);
            return null;
        } else {
            var newValue = dataObj.val;
        }
        return newValue;
    } else {
        return null;
    }
}