/** * $stime 开始时间 $etime 结束时间 $table 表前缀 */ public function getcalltablename($starttime,$endtime,$tablename){ $startsj=strtotime($starttime); $endsj=strtotime($endtime); $daynums=floor(($endsj-$startsj)/86400)+1; $data=array(); $db = M(); $sql="use asteriskcdrdb"; $db->query($sql); $sql = " show tables like ‘%".$tablename."%‘"; $dataarray = $db->query($sql); for($i=0;$i<$daynums;$i++){ $t_name=$tablename.date("Y_n_j",$startsj+$i*86400); for($j=0;$j<count($dataarray);$j++){ if($t_name==$dataarray[$j][‘Tables_in_asteriskcdrdb (%‘.$tablename.‘%)‘]){ $data[]=$t_name; } } } return $data; }
本文出自 “phpAjax请求” 博客,谢绝转载!
原文地址:http://15129824665.blog.51cto.com/10510385/1843046