如上图中有许多文件。PHP怎么循环列出liuyanben文件夹里的所有文件的权限,并依次列出
就像dz安装时检查文件权限的列表似得
改用什么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 在任意进制之间转换数字 * fileperms 取得文件的权限 */ // 获取权限 function getChmod($filepath){ return substr(base_convert(@fileperms($filepath),10,8),-4); }
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 .