2013-02-04 29 views
0

如何使用Ant在目錄中執行每個 php文件? php執行的輸出應該覆蓋原始文件。Ant:如何用php文件調用目錄並將結果保存爲覆蓋文件

該目錄是在安裝php的localhost web服務器上。我假設解決方案將涉及GET並且src指向每個文件的http等價物。

一些動態版本的
C:/webroot/php/file1.php
C:/webroot/php/file2.php

轉化爲
GET SRC =「本地主機/ PHP /文件1。 php「
get src =」localhost/php/file2.php「

然後讓輸出覆蓋本身。

回答

0

爲什麼不使用php command line加上ANT apply任務?

喜歡的東西:

<apply executable="C:\PHP5\php.exe"> 
    <arg value="-f"/> 
    <fileset dir="c:/webroot/php" includes="*.php"/> 
</apply> 

爲什麼你要覆蓋源文件這不是很清楚,我....

更新

或者使用嵌入式腳本groovy

<fileset id="phpfiles" dir="c:/webroot/php" includes="*.php"/> 

<groovy> 
    project.references.phpfiles.each { 
     def file = new File(it.toString()) 
     ant.get(src:"http://localhost/php/${file.name}", dest:"output/${file.name}") 
    } 
</groovy> 
+0

對於另一個用戶來說,這可能是一個好方法。我正在尋找一種通過XAMPP Web服務器通過Get獲取的方法。 – Pelle

+0

@Pelle更新了答案 –

相關問題