我已经部署了我的web app -- google app engine中的php app。App.yaml代码
runtime: php55
api_version: 1
#threadsafe: true
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
- url: /mail
static_dir: www/mail
# Serve php scripts.
- url: /mail/.*
script: www/mail/mailsender_1.php
- url: /(.*)$
static_files: www/\1
upload: www/(.*)
但是,当从javascript - ajax调用调用/mail/mailsender_1.php
时,它不会将mailsender_1.php
识别为php脚本。我花了一整天的时间进行调试。任何帮助都将不胜感激。
发布于 2020-04-20 17:28:28
通过查看您的问题并与此community question进行比较,我发现您面临的问题是由于/(.*)$
处理程序而不是/mail/.*
处理程序造成的。
文章中公认答案表明,您的/(.*)$
处理程序使部署人员认为您的www/
目录中的所有文件都是静态的和可上载的,包括.php
脚本。
根据评论,我的建议是将upload: www/(.*)
指令更改为upload: www/(.*)\.(js|css|png|jpg|jpeg|map|woff)
,因为它将适合您拥有的所有文件扩展名。
因此,您的处理程序部分应该如下所示:
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
- url: /mail
static_dir: www/mail
# Serve php scripts.
- url: /mail/.*
script: www/mail/mailsender_1.php
- url: /(.*)$
static_files: www/\1
upload: www/(.*)\.(js|css|png|jpg|jpeg|map|woff)
https://stackoverflow.com/questions/61267035
复制相似问题