function file_get_contents_new($url, $wait = 3) {
if (http_response($url, '200', $wait)) {
return file_get_contents($url);
} else {
return FALSE;
}
}
function OO_chart($query_stub, $length)
{
$key = $this->OO_charts_key;
$url_api = "https://api.oocharts.com/v1/query.jsonp?query={$query_stub}&key={$key}&start={$length}";
$json = file_get_contents_new($url_api);
if (file_get_contents_new($url_api) ? (string) true : (bool) false && (bool) $this->OO_active) {
return json_decode($json, TRUE);
} else {
$msg = new Messages();
$msg->add('e', 'JSON error. Check OOcharts api.');
redirect('index.php');
}
}
將file_get_contents_new($ url_api)? (字符串)true:(布爾)以這種方式做假工作? 如在,它將評估爲true
如果函數輸出string
, 並且它將評估爲false
如果函數是bool
?三元運算符評估爲真如果字符串或假如果布爾
你試過了嗎? – 1234567
看到我的回答,我建議使用其他類型評估。 – 1234567