$files = array();
$dir = opendir(dirname(realpath(__FILE__)).'/files/'.$fil_fi_row['file_name'].'/');
while ($file = readdir($dir)) {
if ($file == '.' || $file == '..') {
continue;
}
$allfiles[] = $file;
}
$total_arr=array_merge((array)$id,(array)$files);
sort($total_arr);
foreach($total_arr as $key=>$file){
if($key != count($total_arr)-1)
$array[‘Files’][] = array(
‘files’ => $file,
‘id’ => $id,
);
}
}
echo json_encode($array, JSON_UNESCAPED_UNICODE);
Я пробовал JSON_UNESCAPED_UNICODE
, но не работает; ОШИБКАjson_encode() не отображает арабские символы (opendir)
Notice: Use of undefined constant JSON_UNESCAPED_UNICODE - assumed 'JSON_UNESCAPED_UNICODE' in /home/...
Warning: json_encode() expects parameter 2 to be long, string given in /home/..
Когда я использую
echo json_encode($array);
имя Arabic файл выглядит как:
8508_\u0645\u0635\u0631 \u0627\u0643\u0631\u0645 20150908
'JSON_UNESCAPED_UNICODE' был введен с PHP 5.4 – mario
показать содержимое '$ array' – RomanPerekhrest
RomanPerekhrest посмотреть код сейчас ... спасибо – OsamahM