分类 技术分享 下的文章

示例:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{http_host} ^cnweed.com [NC]
RewriteRule ^(.*)$ https://www.cnweed.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

$(function () {
    var imgList=document.getElementById('pic_list');
    if(imgList!=null){
        var imgs=imgList.getElementsByTagName('img');
        var w=imgList.offsetWidth;
        for(var i=0;i<imgs.length;i++){
          imgs[i].onload=function(){
              console.info( this.width,this.height )
              if( w < this.width ) this.width=w;
          }
        }
    }
});

获取前一天的时间:
$mytime= date("Y-m-d H:i:s", strtotime("-1 day"));

获取三天前的时间:
$mytime= date("Y-m-d H:i:s", strtotime("-3 day"));

获取前3个月的时间:
$mytime= date("Y-m-d H:i:s", strtotime("-3 month"));

获取前一个小时的时间:
$mytime= date("Y-m-d H:i:s", strtotime("-1 hour"));

获取前一年的时间:
$mytime= date("Y-m-d H:i:s", strtotime("-1 year"));

//判断是支付宝app的浏览器
 var userAgent = navigator.userAgent.toLowerCase();

    if(userAgent.match(/Alipay/i)=="alipay"){
        return true;
    }else{
        return false;
    }



//判断是微信app的浏览器
function isWechat(){
    var userAgent = navigator.userAgent.toLowerCase();

    if(userAgent.match(/MicroMessenger/i)=="micromessenger") {
        return true;
    } else {
        return false;
    }
}

http://blog.csdn.net/xiejunna/article/details/74989704

比较简单的判断方式,直接查询域名是否存在dns……

if(IS_POST){
    $sld=I('sld');
    $tld=I('tld');
    $domain=$sld.$tld;
    $response = @dns_get_record($domain, DNS_ALL);

    if(empty($response)){
        echo "<H2 style='color:green;' >Domain $name_domain is available.</H2>";
    }else{
        echo "<H2 style='color:red;'>Domain $name_domain has taken.</H2>";
    }
}

我尝试在DirectAdmin中创建Let's Encrypt免费SSL证书时出错。返回如下:

Cannot Execute Your Request

Details

Getting challenge for parniagroup.com from acme-server...
User let's encrypt key has been found, but not registered. Registering...
Account registration error. Response: HTTP/1.1 100 Continue 
Expires: Wed, 03 Aug 2016 08:08:26 GMT 
Cache-Control: max-age=0, no-cache, no-store 
Pragma: no-cache 

HTTP/1.1 400 Bad Request 
Server: nginx 
Content-Type: application/problem+json 
Content-Length: 265 
Boulder-Request-Id: vdS0ublv2yTS3g8BkAW4mjM9f-HCiYV6DgYrfCkaLqI 
Replay-Nonce: QUnGB2x_ZY1sJRrGG3MgS9fwtegzDawR8xj1uJ4E50o 
Expires: Wed, 03 Aug 2016 08:08:27 GMT 
Cache-Control: max-age=0, no-cache, no-store 
Pragma: no-cache 
Date: Wed, 03 Aug 2016 08:08:27 GMT 
Connection: close 

{
"type": "urn:acme:error:malformed",
"detail": "Provided agreement URL [https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf] does not match current agreement URL [https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf]",
"status": 400
}.

- 阅读剩余部分 -

if(IS_POST){
    $rqstart = I('rqstart');
    $rqend = I('rqend');
    $begintime = strtotime($rqstart. ' 00:00:00');
    $endtime = strtotime($rqend. ' 23:59:59');

    //日期范围内查询条件
    $map['billing_time'] = array(array('EGT', $begintime), array('ELT', $endtime));

    $alipay    = $Billing->where($map)->where(array('billing_pay_manner'=>'alipay'))->sum('billing_price');
    $weixinpay = $Billing->where($map)->where(array('billing_pay_manner'=>'weixinpay'))->sum('billing_price');

    //组装数据
    if($weixinpay>0 or $alipay>0){
        $data=array("alipay"=>"$alipay","weixinpay"=>"$weixinpay");
        $this->ajaxReturn($data);
    }else{
        $data="-1";
        $this->ajaxReturn($data);
    }
}

MAC安装完MySQL后在终端无法和Linux一样简单的用 "msyql" 登入管理,可以通过以下设置简化。

MySQL安装的位置在 /usr/local/mysql

设置一个别名即可:

$alias mysql='/usr/local/mysql/bin/mysql'

现在就可以和Linux一样通过命令管理,如:

$mysql -u root -p