0
$url = 'xxxxxxxxx';
$result = file_get_contents($url);
$stuff = json_decode($result, true);
if (false !== ($contents = $stuff)) {
echo $contents;
} else {
//do nothing
}

If query doesnt return any result, I want to show nothing

Instead I am getting

Warning: file_get_contents(xxxx) [function.file-get-contents]: 
failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home/xxxxx/xxx.php on line 4 
4

1 回答 1

3

@在函数或集合之前添加一个error_reporting(0)(不推荐,因为所有错误都会被抑制)。

于 2013-07-22T14:48:49.807 回答