我写了这样的PHP代码
$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
Run Code Online (Sandbox Code Playgroud)
但当我删除"http://"时,$site我收到以下警告:
警告:file_get_contents(www.google.com)[function.file-get-contents]:无法打开流:
我尝试过try,catch但它没有用.
我得到了预期的通知和警告,并希望在我的php文件上关闭它们.错误是:
Warning: fsockopen()
Run Code Online (Sandbox Code Playgroud)
和通知是:
Notice: A non well formed numeric value encountered in
Run Code Online (Sandbox Code Playgroud)
我打算在这个PHP脚本中使用cron,并且不希望在任何地方记录任何错误或通知.