【发布时间】:2021-03-05 10:10:38
【问题描述】:
我在 Google App Engine 环境中遇到了一个 php 脚本问题。
我尝试使用 ajax-call 调用 php 脚本,但成功回调总是返回未处理的 php 文件 (<?php .... ?>)
ajax 调用如下所示:
$.ajax({
type: "POST",
url: "/contactform-process.php",
data: "name=" + name + "&email=" + email + "&message=" + message + "&terms=" + terms,
success: function(text) {
console.log('Hello')
if (text == "success") {
cformSuccess();
} else {
cformError();
csubmitMSG(false, text);
}
}
});
我假设我必须声明 Google App Engine 环境正在正确处理 php 文件。我当前的 app.yaml:
runtime: php74
handlers:
- url: /
static_files: static/index.html
upload: static/index.html
- url: /de
static_files: static/de/index.html
upload: static/de/index.html
- url: /en
static_files: static/en/index.html
upload: static/de/index.html
- url: /(.*)
static_files: static/\1
upload: static/(.*)
- url: /(.+\.php)$
script: auto
- url: /contactform-process.php
script: auto
有人知道遗漏了什么,所以 php 文件会以正确的方式处理吗?
【问题讨论】:
标签: php ajax google-app-engine