龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

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

时间:2014-08-27 11:03来源:网络整理 作者:网络 点击:
分享到:
php列出当前目录下的所有php文件 [代码片段(15行)]
<?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>";
}

?>

精彩图集

赞助商链接