如上圖中有許多文件。PHP怎么循環(huán)列出liuyanben文件夾里的所有文件的權(quán)限,并依次列出
就像dz安裝時檢查文件權(quán)限的列表似得
改用什么PHP代碼???
PHP checks the permissions of all files in a directory and lists them - PHP Chinese website Q&A - PHP checks the permissions of all files in a directory and lists them - PHP Chinese website Q&A
Take a look around and learn .
<?php function?stripleft($string,$str){ $i=stripos($string,$str); if($i===0){ return?substr($string,strlen($str)); }else{ return?$string; } } $files=glob(FCPATH.'*.*'); foreach($files?as?$k=>$f){ $a=stripleft($f,FCPATH); echo?$a.'?|?'.getChmod($a).'<br>'; }
/* ?*?substr?返回字符串的子串 ?*?base_convert??在任意進制之間轉(zhuǎn)換數(shù)字 ?*?fileperms??取得文件的權(quán)限 ?*/ //?獲取權(quán)限 function?getChmod($filepath){ ????return?substr(base_convert(@fileperms($filepath),10,8),-4); }