关于正则匹配字符串之间的字符

<?php
  header("content-type:text/html;charset=utf-8");
  session_start();
  date_default_timezone_set('PRC');
  ini_set('memory_limit','2048M');
  include ("mysql.php");
  $t=new db('test');
  $pattern='/SET timestamp=\d{10};(.*?)# Time: \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z/s';
  $dir = "log";
  $a = scandir($dir,1);
  $length=count($a)-2;
  for($i=0;$i<$length;$i++){
    $cont=file_get_contents('log/'.$a[$i]);
    preg_match_all($pattern, $cont, $matches);
    foreach ($matches[1] as $key => $value) {
        $sql="INSERT INTO sql_item VALUES (NULL , '{$value}')";
        $t->query($sql);
    }
  }
内容:SET timestamp=1505808023;
select id,cover,tel,tel2,title,areaid,areaid_hy,posttime,isyp,price,begindate,enddate from infos where isshow=1 and isyp=0 and bigsortid=1 and sortid=42 and areaid=1 order by ordertime desc limit 180,20;
# Time: 2017-09-19T08:00:24.349152Z
# User@Host: root[root] @ localhost []  Id:    10
# Query_time: 0.999307  Lock_time: 0.000060 Rows_sent: 1  Rows_examined: 282906
SET timestamp=1505808024;
SELECT count(infos.id) as num
FROM (`infos`)
WHERE `isshow` =  1
LIMIT 1;
# Time: 2017-09-19T08:00:24.414706Z
# User@Host: root[root] @ localhost []  Id:    17
# Query_time: 0.808071  Lock_time: 0.000714 Rows_sent: 6  Rows_examined: 238787
use vanpeopl_info;
SET timestamp=1505808024;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值