我正在尝试使用 php 做一些事情:我有一个包含 2650 个子文件夹的文件夹......是的,很多。目前,我有 2 个脚本在每个子文件夹上处理一个 xml,但我必须手动进入每个文件夹,将 xml 复制到 www 文件夹,为每个文件夹运行两个脚本(localhost/script1.php 和 localhost/script2.php) ...有没有办法在所有子文件夹上运行这两个脚本?这是文件夹的结构:
C:\wamp\www\Games\Game1\Meta-inf\details.xml
C:\wamp\www\Games\Game2\Meta-inf\details.xml
C:\wamp\www\Games\Game3\Meta-inf\details.xml
我想运行一个脚本,我们称它为 runner.php,它执行以下操作:
http://localhost/runner.php
cd Games
cd Game-1
cd Meta-inf
RUN script1.php
RUN script2.php
cd ..
cd ..
cd Game-2
cd Meta-inf
RUN script1.php
RUN script2.php
.
.
.
cd Game-2650
cd Meta-inf
RUN script1.php
RUN script2.php
EXIT foreach
Exit php
这里的问题是我不知道如何制作一个进入 Gamex/Meta-inf/ 并处理 xml 的新 php 脚本。2 个脚本中的每一个都会创建一个新文件(1 个 excel 和 1 个 txt),这些文件应该在 /Game/Gamex/ 文件夹中创建......应该在每个脚本上修改,对吧?
太感谢了!