php读取linux资料

WBOY
Release: 2016-06-13 10:54:27
Original
815 people have browsed it

php读取linux文件
请大家帮忙写一个php读取linux文件内容并显示的例子,如我的文件linux绝对路径 /etc/a/b/c.conf,我把文件权限改成了777
我这样写的:

  $testfile="/etc/a/b/c.conf";
  $fp=fopen($testfile,'r+');
  $outputtext=fgets($testfile,filesize($testfile));
  echo "$testfile文本内容:".$outputtext;
  fclose($fp)
?>

但是没有输出内容,请大家看下是什么问题?是文件路径的写法有问题还是什么其他原因?

------解决方案--------------------
file_get_contents() 试试这个

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