Php 对phing目标中的每个文件执行命令

Php 对phing目标中的每个文件执行命令,php,phing,Php,Phing,如何在phing中对文件集目标的每个文件执行目标操作?例如: <exec command="cat {$filepath}"> <fileset dir="."> <include name="*.php"> </fileset> </exec> 您可以将foreach任务与文件集一起使用,例如: <?xml version="1.0" encoding="utf-8"?> <project name

如何在phing中对文件集目标的每个文件执行目标操作?例如:

<exec command="cat {$filepath}">
  <fileset dir=".">
    <include name="*.php">
  </fileset>
</exec>

您可以将foreach任务与文件集一起使用,例如:

<?xml version="1.0" encoding="utf-8"?>
<project name="cat-fileset" basedir="." default="iterate">
    <target name="iterate">
        <foreach param="fname" absparam="abs-fname" target="cat">
            <fileset dir="${project.basedir}">
                <include name="*.php" />
            </fileset>
        </foreach>
    </target>    
    <target name="cat">
        <exec command="cat ${abs-fname}" 
            escape="false"
            checkreturn="true"
            passthru="true" />
    </target>
</project>

请注意,此功能是在Phing的2.4.0版中实现的
这是我的phing版本:phing版本2.3.3我遇到了以下错误:初始化嵌套元素时出错[wrapped:phing.tasks.system.ForeachTask不支持“文件集”创建者/加法器。]]很抱歉,它不是2.3.1,而是2.4.0:最新的稳定版本是2.4.1,您可能需要升级。
<apply executable="cat" parallel="false">
  <fileset dir=".">
    <include name="*.php">
  </fileset>
</apply>