0
所以我想讀取一個JSON文件在一個單獨的網址和基於什麼是JSON文件,我想讓程序做些什麼。但目前我試圖做到這一點的方式不起作用。使用包含密鑰與file_get_contents
<?php
$homepage = file_get_contents('http://direct.cyberkitsune.net/canibuycubeworld/status.json');
//echo $homepage;
if($homepage contains 'f'){
echo 'true';
}else{
echo 'Something went terribly wrong!";
}
?>
這是錯誤,我得到
Parse error: syntax error, unexpected T_STRING in /home/a1285224/public_html/cubeworld.php on line 4
當我搜索了「的file_get_contents」下的PHP手冊它說,它應該將整個文件讀入一個字符串,所以我有點困惑爲什麼我得到一個字符串錯誤。
謝謝〜