Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用PHP解析JSON文件-status_Php_Json - Fatal编程技术网

用PHP解析JSON文件-status

用PHP解析JSON文件-status,php,json,Php,Json,我尝试使用PHP解析JSON文件。但我现在被困住了 这是我的JSON文件 { "status": "200", "port": "7777", "maxplayers": 10, "playercount": "2", "players": "citron6946, Galios, Example" "uptime": "4.06:17:21", } 到目前为止我的PHP。。。 我只需要简单的文本显示,你可以调整字体 Status: online Uptimne: 4

我尝试使用PHP解析JSON文件。但我现在被困住了

这是我的JSON文件

{
  "status": "200",
  "port": "7777",
  "maxplayers": 10,
  "playercount": "2",
  "players": "citron6946, Galios, Example"
  "uptime": "4.06:17:21",
} 
到目前为止我的PHP。。。 我只需要简单的文本显示,你可以调整字体

Status: online
Uptimne: 4d 6h 17m 21s
Port: 7777
Maxplayers: 10
Players: citron6946, Galios, Example
你能帮我吗?

你现在可以打印出来了

<?php 

$json = '{"status": "200","port": "7777","maxplayers": 10,"playercount": "2","players": "citron6946, Galios, Example","uptime": "4.06:17:21"}';
$out = json_decode($json, true);

echo var_dump($out);
编辑

替换

echo var_dump($out):


它不依赖于json。您应该使用Ajax使该脚本自动化。你是从其他网站下载json还是什么?
echo var_dump($out):
foreach($out as $key=> $value) echo $key.":".$value."<br>";
status:200
port:7777
maxplayers:10
playercount:2
players:citron6946, Galios, Example
uptime:4.06:17:21