if($_GET['operacao'] == 'banners'){
header('Content-Type: application/json; charset=utf-8');
$rs = $mysqli->query("SELECT foto AS image FROM banners");
$registros = mysqli_num_rows($rs);
$arr = array();
$url = "http://www.site.com.br/";
while($row = $rs->fetch_assoc()) {
$arr[] = $row;
}
$json_encode = json_encode($arr);
echo $json_encode;
}
This code above generates a json like this:
[
{"image": "freightliner.jpg"},
{"image": "sailing-ships.jpg"},
{"image": "taxi-cab.jpg"
}
]
How to make the URL appear and look like this:
[
{"image": "http://www.site.com.br/freightliner.jpg"},
{"image": "http://www.site.com.br/sailing-ships.jpg"},
{"image": "http://www.site.com.br/taxi-cab.jpg"
}
]