我有一個php文件正在創建我的用戶目錄中的所有內容,然後這個數組被髮送回iPhone。按修改日期排列此數組?
,我的PHP是創建按字母順序排序他們的陣列,我希望它由文件創建日期進行排序..
這裏是我的PHP文件看起來像
<?php
$username = $_GET['username'];
$path = "$username/default/";
$files = glob("{$path}/{*.jpg,*.jpeg,*.png}", GLOB_BRACE);
// output to json
echo json_encode($files);
?>
如何我會這樣做嗎?
謝謝:)
完美的作品,謝謝! – Jacob
我需要添加$ dirPath:global $ dirPath; if(filemtime($ dirPath。$ a)== filemtime($ dirPath。$ b))。 。 。 – Atara