【发布时间】:2015-01-25 20:10:18
【问题描述】:
这是我的结构目录:
Main directory
all.php
file.php
URL1.txt
SubDirectory1
URL2.txt
file.php
文件 file.php 像这样:
$filename = glob("URL*");
echo $filename[0];
文件all.php
<?php
include('./SubDirectory1/file.php');
?>
问题是当我运行文件 all.php 时,浏览器显示 URL1.txt。为什么它不显示 URL2.txt。如何解决?谢谢!
【问题讨论】:
-
因为脚本
file.php是从all.php的位置执行的,所以在这个文件夹中只有URL1.php被发现! -
试试这个
glob("SubDirectory1/*"); -
@Indrasinh Bihola,嗨,有什么方法可以自动添加子目录?因为我有很多子目录,所以很难一一更改。