使用PHP输出JSON数据并获得白屏

时间:2016-02-16 16:30:07

标签: php json

这是我的JSON数据的PHP代码。当我想打开localhost / x / json.php时。我正在看一个白色的屏幕。

<?php

$host = "**";
$user = "**";
$pass = "**";
$db = "**";


$sql = "select * from diziler";
$con = mysqli_connect($host,$user,$pass,$db);

$result = mysqli_query($con,$sql);
$response = array();

while($row = mysqli_fetch_array($result)){
   array_push($response,array("dizi"=>$row[0],"kanal"=>$row[1],"sure"=>$row[2]));
}

echo json_encode(array("server_response"=>$response));
mysqli_close($con);

?>

0 个答案:

没有答案