2016-05-08 4 views
0
$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)

8508_\u0645\u0635\u0631 \u0627\u0643\u0631\u0645 20150908 
+0

(PHP5.4.0の+)、これを試してみてください。私は

echo json_encode($array); 

を使用する場合 ERRORは

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/.. 

アラビアファイル名がとして表示されますPHP 5.4で導入されました – mario

+1

'$ array'の内容を表示します – RomanPerekhrest

+0

RomanPerekhrestはコードを見ています...ありがとう – OsamahM

答えて

0

JSON_UNESCAPED_UNICODE` `

json_encode($result, JSON_UNESCAPED_UNICODE); 
+0

が機能しない(空白ページ) – OsamahM

+0

これはPHPのバージョンを意味します<5.4 –

関連する問題