2011-05-23 18 views

回答

1

认沽文件列表到数组和遍历它:

// ex. glob('*.pdf'); 
$files = array(
    'CPC_2001_5_21_7.pdf', 
    'CPC_2001_12_21_70.pdf', 
    'CPC_2001_03_06_56.pdf', 
    'CPC_2001_9_12_8.pdf' 
); 

$max = 0; 
foreach($files as $f){ 
    sscanf($f, '%s_%d_%d_%d_%d.pdf', $str, $year, $month, $day, $xx); 

    if($xx > $max) 
     $max = $xx; 
} 
相关问题