-1
下のマイPHPスクリプト:JSONデータ配列
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "college";
$con = mysqli_connect($host,$user,$pass,$db);
$query = "SELECT firstname, secondname, pic FROM student";
$result = mysqli_query($con,$query);
$response = array();
While($row= mysqli_fetch_array($result))
{
array_push($response,array('fname'=>$row[0], 'sname'=>$row[1], 'pic'=>$row[2]));
}
mysqli_close($con);
echo json_encode(array('server_response'=>$response));
?>
出力:私は以下のように適切なURLで出力を持つようにJSONデータをデコードすることができますどのように
{"server_response":[{" fname":"john","sname":"mark","pic":"http:\/\/localhost\/ServerSide\/jm.jpg"}]}
:
{"server_response":[{" fname":"john","sname":"mark","pic":"http://localhost/ServerSide/jm.jpg"}]}
プラス1つ(+1)です。 – Vincent