JSON_decode和PHP没有分号(,)

example.php

{"status": "ok"} {"status": "error"}

i will result like :

ok , error

my website showing a blank page(im using this code),can you help me to fix it?

<?php
$userinfo = 'example.php';
$fgc = file_get_contents($userinfo);
$json2 = json_decode($fgc, true);
$media = $json2['status'];

$mediaId = $media;

echo $mediaId;
?>

This will resolve your issue in the non-recommended way:

$broken_json = '{"success": "ok"} {"success": "error"}';
$fixed_json = "[" . str_replace("} {", "},{", $broken_json) . "]";
echo $fixed_json;

$array = json_decode($fixed_json, true);

echo "<pre>";
var_dump($array);
echo "</pre>";

Result:

[{"success": "ok"},{"success": "error"}]

array(2) {
  [0]=>
  array(1) {
    ["success"]=>
    string(2) "ok"
  }
  [1]=>
  array(1) {
    ["success"]=>
    string(5) "error"
  }
}

Recommended Way:

Actually get VALID JSON from the source

example.php does not contain valid JSON

Here's probably what you want:

 [ {"status": "ok"} , {"status": "error"} ]

You can validate JOSN here: http://jsonlint.com/

You can find more on how to debug PHP "white screen of death" here: PHP's white screen of death (read the top two answers)