php 常用函数总汇

php 使用命令行函数exec($sql,$result,$status);

$sql 命令   $result  返回东西  $status成功与否的状态

例如:

php使用命令行去执行数据库备份(详情在这里

$exec="mysqldump -h localhost -uroot -pXiaozuanfeng --default-character-set=utf8 we8 > /var/www/backsql/we8".$time.".sql";
exec($exec, $result, $status);

 

php 几天前的时间(或几天后)

$backtime = date("Y-m-d",strtotime("-5 day"));

$backtime = date("Y-m-d",strtotime("+5 day"));

 

php 获取文件函数 file_get_content(.txt;.log.cvs文件)

 

php 数组排序array_multisort($volume, SORT_DESC, $edition, SORT_DESC, $vo, SORT_DESC, $ed, SORT_DESC, $res);

 

foreach ($res as $key => $row)
{
  $volume[$key] = $row['pan_man'];
  $edition[$key] = $row['order_man'];
  $vo[$key] = $row['pv'];
  $ed[$key] = $row['uv'];
}
if(!empty($res)){
array_multisort($volume, SORT_DESC, $edition, SORT_DESC, $vo, SORT_DESC, $ed, SORT_DESC, $res);
}

 

posted @ 2018-07-26 17:30  罗马的路上  阅读(183)  评论(0编辑  收藏  举报