with this php code:
<? header('Content-type: application/json'); ?>
<?
$files = glob("sources/".$_GET['dir'].'/img/*');
echo json_encode($files);
?>
I'm getting:
["sources\/nine\/img\/0010.jpg","sources\/nine\/img\/0011.jpg"]
But i want:
["sources/nine/img/0010.jpg","sources/nine/img/0011.jpg"]
Actually, this is not glob()
, this is json_encode()
's doing and it's perfectly okay: It's escaping slashes as suggested by the JSON standard. See this php.net bug report for further discussion.