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