Home > Backend Development > PHP Tutorial > php读取资料失败?

php读取资料失败?

WBOY
Release: 2016-06-13 12:48:22
Original
754 people have browsed it

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($handle=@fopen($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 />
}
Copy after login





下面是前台读取格式



  • $rs[name]

  •  





    为什么,上面那段php运行后,什么都不显示呢,是哪里有问题了??
    PHP 函数
    ------解决方案--------------------
    如果是linux上看看文件是否有权限读
    ------解决方案--------------------
    先把抑制错误的@都去掉了,看看是什么出错
    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template