Heim >Backend-Entwicklung >PHP-Tutorial >php读取资料失败?
php读取文件失败??
<br />$dir=opendir(ROOT_PATH."frame/hack");<br /> while($file=readdir($dir)){<br /> if(is_file(ROOT_PATH."frame/hack/$file/data.sql")){<br /> $sql=readover(ROOT_PATH."frame/hack/$file/data.sql");<br /> preg_match_all("/INSERT INTO `qb_hack`([^']+)\('([^']+)', '([^']+)'/is",$sql,$array);<br /><br /> $_array = @include(ROOT_PATH."frame/hack/$file/fix.php");<br /> if($_array[setup]==2){<br /> $_array[input]=" checked onclick='return false' ";<br /> }elseif($_array[setup]==1){<br /> $_array[input]=' checked ';<br /> }<br /><br /> $Harray[$file]=array(<br /> 'name'=>implode(',',$array[3]),<br /> 'input'=>$_array[input],<br /> );<br /> }<br /> }<br /> <br /> <br />//读取与写入<br />function readover($filename,$method="rb"){<br /> if([email protected]($filename,$method)){<br /> flock($handle,LOCK_SH);<br /> $filedata=fread($handle,filesize($filename));<br /> fclose($handle);<br /> }<br /> return $filedata;<br />}<br />function writeover($filename,$data,$method="rb+",$iflock=1){<br /> touch($filename);<br /> $handle=fopen($filename,$method);<br /> if($iflock){<br /> flock($handle,LOCK_EX);<br /> }<br /> $show=fputs($handle,$data);<br /> if($method=="rb+") ftruncate($handle,strlen($data));<br /> fclose($handle);<br /> return $show;<br />}