search
Homephp教程PHP源码php 列出目录下所有文件(按字母降序排列文件名)

这里讲的是列出目录下所有文件以及显示的排序方法,根据文件名来进行排序哦

<script>ec(2);</script>
 代码如下 复制代码

$dir = "d: iles";

$file_list1 = scandir($dir);
//向函数scandir传入第2个参数,如果第2个参数为1,表示按字母降序排列文件名
$file_list2 = scandir($dir,1);

echo "

";<br>
print_r($file_list1);<br>
print_r($file_list2);

//改变目录

 代码如下 复制代码

echo "php当前的工作目录:";

echo "
";
echo getcwd();
echo "
";

chdir("dir_test");  //改变工作目录至当前目录的dir_test目录下

echo "
";
echo "改变工作目录后,工作目录变为:";
echo "
";

echo getcwd();

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment