【问题标题】:Getting my app.yaml PHP configuration to work in Google App Engine让我的 app.yaml PHP 配置在 Google App Engine 中工作
【发布时间】:2018-09-26 07:13:50
【问题描述】:

我对 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_[] 它只是更改了网址但它不会被页面处理。到目前为止,我的 logo.png 显示在我的索引上,但到目前为止,我无法弄清楚。

示例:.php?ID=99999999&group=All 我认为我需要对 YAML 做一些事情才能真正完成上述工作。

此页面无法运行 rank.games 目前无法处理 这个请求。 HTTP 错误 500

当我给上面的例子加上后缀时,这就是我得到的。

【问题讨论】:

    标签: php google-app-engine include app.yaml


    【解决方案1】:

    您的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
    

    【讨论】:

      猜你喜欢
      • 2013-12-28
      • 2015-05-15
      • 2014-10-10
      • 1970-01-01
      • 2020-12-28
      • 2010-10-10
      • 2017-08-18
      • 1970-01-01
      • 2022-01-24
      相关资源
      最近更新 更多