Gulp插件用于运行PHP服务器

Gulp插件用于运行PHP服务器

本文介绍了Gulp插件用于运行PHP服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从咕噜转变为吞噬。但是,我没有找到一种方法来为PHP文件提供livereload支持,比如网关()使用挂载。是否有任何插件用于运行/服务器PHP使用gulp任务?

解决方案

几周前我问完全相同的问题。我想在Gulp下启动一个本地PHP服务器,因为我喜欢比Grunt更好的语法。我也想使用PHP来包含其他HTML文件。 :)原来有一个'gulp-connect-php'plugn,它的语法和'grunt-php'插件非常相似。





以下是我的代码给Gulp:

  var gulp = require('gulp'),
livereload = require('gulp-livereload'),
connectPHP = require('gulp-connect-php');
$ b gulp.task('connect',function(){
connectPHP.server({
hostname:'0.0.0.0',
bin:'C: /php/php.exe',
ini:'C:/php/php.ini',
端口:8000,
ase:'dev',
livereload:true
});
});

我还设置了exe和ini文件位置。



如果您有兴趣,这是Grunt的代码:

  php:{
watch:{
选项:{
livereload:true,
bin:'C:/php/php.exe',
ini:'C:/php/php.ini',
base:'../development',
port:8000
}
}
}

我希望它有帮助!


I'm looking to transition over from grunt to gulp. However I'm not finding a way to serve PHP files with livereload support, such as gateway (https://www.npmjs.org/package/gateway) using mounts. Are ther any plugins out there for running/server PHP using a gulp task?

解决方案

I asked totally the same question few weeks ago. I want to start a native PHP server under Gulp, because I like the syntax better than Grunt. I also want to use PHP just to include other HTML files. :) It turns out there is a 'gulp-connect-php' plugn which has a very similar syntax to 'grunt-php' plugin.

https://www.npmjs.com/package/gulp-connect-php

https://www.npmjs.com/package/grunt-php

Here is my code to Gulp:

var gulp = require('gulp'),
    livereload = require('gulp-livereload'),
    connectPHP = require('gulp-connect-php');

gulp.task('connect', function() {
  connectPHP.server({
    hostname: '0.0.0.0',
    bin: 'C:/php/php.exe',
    ini: 'C:/php/php.ini',
    port: 8000,
    base: 'dev',
    livereload: true
  });
});

I also setted the exe and ini file location.

If you interested in, this is the code for Grunt:

php: {
  watch: {
    options: {
      livereload: true,
      bin: 'C:/php/php.exe',
      ini: 'C:/php/php.ini',
      base: '../development',
      port: 8000
    }
  }
}

I hope it helps!

这篇关于Gulp插件用于运行PHP服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:22