我对 Google App Engine 完全陌生,app.yaml 严重困扰了我,我无法弄清楚,我到处都找过了,但似乎没有任何效果。这是我的 .yaml,一切都可以在 XAMPP 上运行,但我似乎无法让它在 App Engine 上运行/运行。
runtime: php55
api_version: 1
handlers:
- url: /(.*\.(ico$|jpg$|png$|gif$|htm$|html$|css$|js$|xml$))
static_files: \1
upload: (.*\.(ico$|jpg$|png$|gif$|htm$|html$|css$|js$|xml$))
application_readable: true
- url: /(.+)
script: \1
- url: /
script: index.php
我的索引中包含的内容,例如 <?php include "/static/include/header.php";?>
没有显示在我的页面上,并且该文件也包含我所有的样式/css 等,以及您如何处理 GET_[]
它只是更改 url,但页面不会对其进行处理。到目前为止,我的 logo.png 已显示在我的索引中,但到目前为止,我无法弄清楚。
示例:.php?ID=99999999&group=All
我认为我需要对 YAML 做一些事情才能真正实现上述工作。
This page isn’t working ranked.games is currently unable to handle this request. HTTP ERROR 500
这就是我在上面的示例后缀后得到的结果。
最佳答案
您的 app.yaml
中存在一些问题。将其视为将请求路由到正确目的地的正则表达式匹配过程。 $
位于末尾,而不是针对每个可能的匹配项。
试试这个:
# For better organization, let's put all your static files in a directory called "static", and include files in a directory called `includes`. A .php script is not a static file
- url: /(.*\.(ico|jpg|png|gif|htm|html|css|js|xml))$
static_files: static/\1
upload: static/.*\.(ico|jpg|png|gif|htm|html|css|js|xml)$
application_readable: true
如果您将包含文件放在名为 includes
的目录中,它将如下所示:
- url: /includes/(.+\.php)$
script: /includes/\1
接下来,我们不要向脚本发送垃圾 URL。让我们确保它与 xxx.php
匹配:
- url: /(.+\.php)$
script: \1
关于php - 让我的 app.yaml PHP 配置在 Google App Engine 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52512004/