烈火建站学院(bkjia.com)网络编程 关于php实现列出当前文件列表的方法,网上有很多,近日bkjia.com的小编综合了网上的一些资料, 改写了一下,感觉这是最佳的方法,特别将代码公布出来。
|
以下为引用的内容: function tree($directory)
while($file=$mydir->read() AND $i{ if((is_dir(”$directory”)) AND ($file!=”.”) AND ($file!=”..”)) { $filetime=date(”Y-m-d H:i:s”,filectime($file)); //encode spaces $file = rawurlencode($file); // convert the + (this is one result from the function rawurlencode) in %20 $url = str_replace(’+’ , ‘%20′ , $file); echo “ $i+=1; } } echo “ $mydir->close(); } tree(”.”); // 列出当前目录 |
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号