所以我试图在一个单独的 url 上读取一个 JSON 文件,并根据我想让程序做某事的 JSON 文件中的内容。但是我目前尝试这样做的方式不起作用。
<?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
当我在 php 手册下搜索“file_get_contents”时,它说它应该将整个文件读入一个字符串,所以我有点困惑为什么我会收到一个字符串错误。
谢谢~