php - 应用引擎下载 PHP 代码而不是显示
问题描述
我正在使用 PHP55 通过 Google App Engine 在标准环境中运行网页。当我单击表单上的提交按钮时,它会下载应该执行的相应 PHP 代码。这是我的app.yaml
:
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
- url: /signUp.html
static_files: www/signUp.html
upload: www/signUp.html
- url: /submitEmail.php
static_files: www/submitEmail.php
upload: www/submitEmail.php
- url: /(.*)
static_files: www/\1
upload: www/(.*)
编辑 1 所以我最初为处理程序尝试了以下内容:
handlers:
-url: /(.+\.php)$
script: www/\1
-url: /
script: www/index.html
-url: /(.*)
script: www/\1
然而,简而言之,这是一场灾难。刷新后图像和 CSS 未加载。我想要的只是submitEmail.php
当用户单击表单中的提交时执行index.html
。
为了澄清这是我的高级结构:
www/
-index.html
-submitEmail.php
app.yaml
编辑 2
当前状态,app.yaml
但是当我提交表单时,我收到 404 错误。
handlers:
-url: /(.+\.php)$
script: www/\1
-url: /submitEmail.php
脚本:www/submitEmail.php
-url: /
script: www/index.html
-url: /(.*)
script: www/\1
解决方案
好吧,PHP 代码已交付,因为您将其声明为static_files
. 静态文件在请求时按原样交付给客户端。
像这样更改您的处理程序:
- url: /submitEmail.php
script: www/submitEmail.php
upload: www/submitEmail.php
另请参阅app.yaml 参考。
推荐阅读
- python - 试图用整数值替换数组中的字符串
- nginx - EC2 Nginx 配置 - Prerender 后返回原始 URL
- sql-server - sp_msforeachdb 的替代方法
- java - 类中的自动装配值 null
- jquery - 从 execcommand('copy') jquery 查看创建的输入时出现问题
- sql - 获取值 mit highets value sql
- c# - C# 控制台应用程序在命令行调用时不写入文件,但不写入文件
- jquery - Django - 何时 [以及为什么] 使用 Vue.js?
- javascript - 剑道列表框工具栏在移动视图中滚动到屏幕外
- java - 为什么此代码打印 12 而不是 1?