所有其他静态文件在域中正常运行。
似乎PHP文件没有运行;当我不尝试将其作为脚本运行(并将其作为静态文件上传)时,它可以正常工作;当jQuery调用它时返回明文 - 所以它绝对不是文件路径问题。
但是一旦我将它列为yaml中的php文件,并期望jQuery得到'你好,世界!'它在Firefox网络监视器中返回404,并且在控制台中没有响应。
在App Engine Standard上运行一个单独的服务器端php脚本时,我是否缺少一些东西?
的app.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: (.*)
elastic.php
<?php
return 'Hello, world!'
?>
script.js(在我的index.html中加载jQuery后调用)
$(document).ready(function(){
$.get("./scripts/elastic.php", function( data ) {
console.log(data);
});
});