php备忘录

开启短标签支持:

short_open_tag:on

数据库定时备份:

php -r "system('mysqldump --opt -u root datebase > D:wampwwwackup**'.date('Ymd',time()).'.sql');"

交互行:
readline扩展下载地址:http://ftp.gnu.org/gnu/readline/
 
二维数组排序:
array_multisort(array1,sorting order,sorting type,array2,array3...) 函数返回排序数组。您可以输入一个或多个数组。函数先对第一个数组进行排序,接着是其他数组,如果两个或多个值相同,它将对下一个数组进行排序。
foreach($listBorrow['list'] as $k=>$v){
     $time[$k]=$v['first_verify_time'];
     $progress[$k]=$v['progress'];
 }
array_multisort($progress,SORT_NUMERIC,SORT_ASC,$time,SORT_STRING,SORT_DESC,$listBorrow['list']);
 
各大网站收录、搜索引擎的提交入口:
http://jingyan.baidu.com/article/d5a880eb70424413f147cce4.html
 
cookie跨子域:
设置ini_set('session.cookie_domain', 'cookie_ceshi.com');
 
国家统计局、地址统计:
http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2013/index.html  
 
快递查询:
public function showLogistics(){
  $type=$_POST['type']='shentong';
  $postid=$_POST['postid']='3311725299939';
  //$url = "http://m.kuaidi100.com/index_all.html?type=".$goods_orderarr["express_con"]."&postid=".$goods_orderarr["out_order_num"];
  $url = "http://m.kuaidi100.com/query?type={$type}&postid={$postid}&id=1";
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch,CURLOPT_HEADER, 0); //设置Header
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//测试时输出到页面 0
  $js curl_exec($ch);
  curl_close($ch);
  $re = json_decode($json,true);
  $rs = array(
    "list"=>$re
  );
  if($re["status"]=="200"){
    $re = array("status"=>1,"code"=>200,"msg"=>"确认成功!","data"=>$rs);
      $this->ajaxReturn($re);
  }else{
    $re = array("status"=>0,"code"=>102,"msg"=>"数据异常,请稍后再试!");
    $this->ajaxReturn($re);
  }
}
 
curl_multi_*批处理超时:
while ($mrc == CURLM_CALL_MULTI_PERFORM);改成$active>0
 
 
正则匹配汉字:^[x{4e00}-x{9fa5}]+$
正则匹配双字节文字(包括汉字):^[^x00-xff]+$
 
原文地址:https://www.cnblogs.com/binghuo000/p/6397288.html