所有其他静态文件在域中正常使用。
似乎 PHP 文件没有运行;当我不尝试将其作为脚本运行(而只是将其作为静态文件上传)时,它可以正常工作;当 jQuery 调用它时返回纯文本 - 所以它绝对不是文件路径问题。
但是一旦我将它列为 yaml 中的 php 文件并期望 jQuery 获取“你好,世界!” 它在 Firefox 网络监视器中返回 404,并且在控制台中没有响应。
关于在 App Engine Standard 上运行单独的服务器端 php 脚本,我有什么遗漏吗?
应用程序.yaml
runtime: php55
api_version: 1
threadsafe: true
handlers:
# Serve php scripts another way.
- url: /scripts/elastic.php
script: scripts/elastic.php
# Handle the main page by serving the index page.
# Note the $ to specify the end of the path, since app.yaml does prefix matching.
- url: /$
static_files: index.html
upload: index.html
# Handle folder urls by serving the index.html page inside.
- url: /(.*)/$
static_files: \1/index.html
upload: .*/index.html
# Handle nearly every other file by just serving it.
- url: /(.+)
static_files: \1
upload: (.*)
弹性.php
<?php
return 'Hello, world!'
?>
script.js(在我的 index.html 中加载 jQuery 后调用)
$(document).ready(function(){
$.get("./scripts/elastic.php", function( data ) {
console.log(data);
});
});