Heim >Backend-Entwicklung >PHP-Tutorial >file_get_contents函数可不可以不报错

file_get_contents函数可不可以不报错

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:47:23901Durchsuche

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);

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn