当前位置 : 主页 > 网络编程 > PHP >

php列出当前目录下的所有php文件

来源:互联网 收集:自由互联 发布时间:2021-07-03
php列出当前目录下的所有php文件 ?php//Define directory for files listing//original example//$files = glob('/path/to/dir/*.xml');$files = glob('*.php');//to limit what is displayed you can use a diff listing://$files = array_diff(

php列出当前目录下的所有php文件

<?php
//Define directory for files listing
//original example
//$files = glob('/path/to/dir/*.xml');
$files = glob('*.php');
//to limit what is displayed you can use a diff listing:
//$files = array_diff($files, array('index.php','opendb.php'));
  
foreach ($files as $value) {
echo "<a href=http://changetoyoursite/$value>".$value."</a><br>";
}
  
  
?>
网友评论