01 /** 02 * 获取PDF的页数 03 */ 04 function getPageTotal($path){ 05 // 打开文件 06 if (!$fp = @fopen($path,"r")) { 07 $error = "打开文件{$path}失败"; 08 return false; 09 } 10 else { 11 $max=0; 12 while(!feof($fp)) { 13 $line = fgets($fp,255); 14 if (preg_match('///Count [0-9]+/', $line, $matches)){ 15 preg_match('/[0-9]+/',$matches[0], $matches2); 16 if ($max<$matches2[0]) $max=$matches2[0]; 17 } 18 } 19 fclose($fp); 20 // 返回页数 21 return $max; 22 } 23 }新闻热点
疑难解答