find replace text in file with Phing

后端 未结 6 1122
误落风尘
误落风尘 2021-02-04 06:10

Does anyone know how to find and replace text inside a file with Phing?

6条回答
  •  长发绾君心
    2021-02-04 06:28

    I was looking for the same thing, and I found out that exists a filter named ExpandProperties which allows to replace properties in the copied file. For example I used it in a apache virtual host template:

    
        
        
        
            
                
            
        
        
    
    

    And in the template file

    
       DocumentRoot "${application.startdir}/public"
       ServerName ${apache.default.host}
    
       
           Options Indexes MultiViews FollowSymLinks
           AllowOverride All
           Order allow,deny
           Allow from all
       
    
    
    

    In this way you don't need to explicitly list all the tokens you want replaced, pretty useful...

提交回复
热议问题