我有一个问题,包括我的聚合物项目中的PHP代码。我试图在我的服务器上设置一个“.htaccess”文件,但它不起作用。此外,我不认为有一种简单的方法可以将“index.html”文件更改为“index.php”文件,因为它被引用到许多其他文件中的此文件中,我不知道。我在本地计算机上使用了一个gulp服务器,并试图在其中包含一个PHP支持,但它失败了。这是gulpfile的代码(只需稍加修改形成的原始文件):如何在聚合物中使用PHP?
var gulp = require('gulp');
var connect = require('gulp-connect-php');
...
// Watch Files For Changes & Reload
gulp.task('serve', ['elements', 'images'], function() {
connect.server({}, function(){
browserSync({
notify: false,
snippetOptions: {
rule: {
match: '<span id="browser-sync-binding"></span>',
fn: function (snippet) {
return snippet;
}
}
},
// Run as an https by uncommenting 'https: true'
// Note: this uses an unsigned certificate which on first access
// will present a certificate warning in the browser.
// https: true,
server: {
baseDir: ['.tmp', 'app'],
routes: {
'/bower_components': 'bower_components'
}
}
});
});
gulp.watch(['app/**/*.html'], reload);
gulp.watch(['app/styles/**/*.css'], ['styles', reload]);
gulp.watch(['app/elements/**/*.css'], ['elements', reload]);
gulp.watch(['app/{scripts,elements}/**/*.js'], ['jshint']);
gulp.watch(['app/images/**/*'], reload);
});
...
您显示的代码不是PHP,而是JavaScript。 –
这是gulp配置文件的代码 – ff17x3