2014-12-06 161 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