如何在Polymer中使用PHP?

I have a problem including PHP code in my Polymer project. I have tried to set up a ".htaccess" file on my server, but it did not work. Moreover I do not think there is a easy way to change the "index.html" file to a "index.php" file because it is refered to this file in many other files, I do not know. I am using a gulp server on my local computer and I have tried to include a PHP support there but it failed. This is the code of the gulpfile (only minimal modification form the original file):

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);
});
...

Something like this in your .htaccess file should force the server to treat all the listed file types (extensions) as PHP:

AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .html
DefaultType application/x-httpd-php5

Note the last one is ".html". However, as I noted in the comment, you're not quoting PHP, but JavaScript, and I'd hazard a guess you might just be in over your head a bit.

Good luck. :-)