2014-12-06 163 views
1

我在我的服務器上有一個php腳本(讓我們調用這個/test.php)。 Grunt自動分析了我的SCSS和JS後,我想運行這個test.php腳本(它重置我的memcache)。我似乎無法找到辦法做到這一點。任何人都有線索?用grunt運行php腳本

回答

4

您可以使用grunt-shell通過php -f your-script.php

grunt.initConfig({ 
    shell: { 
     php: { 
      command: 'php -f your-script.php' 
     } 
    } 
} 

grunt.registerTask('runTestPhp', ['shell:php']); 

上運行的CLI PHP腳本如果你不想通過命令行來運行你的PHP腳本,看看grunt-php