Home >Backend Development >PHP Tutorial >file_get_contents函数可不可以不报错

file_get_contents函数可不可以不报错

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:47:23906browse

file_get_contents函数能否不报错

<br />$lyfile = 'E:\key\Logs\lykey.Txt';<br />$bbb = file_get_contents($lyfile);



当没有lykey.Txt这个文件时php就报错,能否不报错就当$bbb = '';(等于空呢)


麻烦知道的大大直接给完整代码,谢谢了
------解决方案--------------------
$bbb = @file_get_contents($lyfile);

Statement:
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