【问题标题】:URL Handlers in Google App Engine PHP Flexible enviromentGoogle App Engine PHP 柔性环境中的 URL 处理程序
【发布时间】:2018-03-05 09:55:39
【问题描述】:

我在 Google App Engine 中部署了一个 PHP 项目作为灵活环境,我想要的是有一个自定义 URL 以便用户可以按下

www.example.com/user

必须指向

www.example.com/core/userProfile/user.php

我已将app.yaml 更改为这个,但我无法让它工作

runtime: php
env: flex
service: api 
api_version: 1
threadsafe: true

resources:
  cpu: 1
  memory_gb: 1
  disk_size_gb: 10

# Starting Point
runtime_config:
  document_root: '.'

# Routers
handlers:
- url: /test.php
  script: /test.php

- url: /index.php
  script: index.php

- url: /user
  script: core/userProfile/user.php

任何网址都会给出以下结果

Error: Not Found
The requested URL /user was not found on this server.

【问题讨论】:

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


    【解决方案1】:

    您的app.yaml 配置将标准环境Handlers element 混合为flexible environment configuration,因此它可能会被忽略。不知何故相关:How to tell if a Google App Engine documentation page applies to the standard or the flexible environment

    您需要在 flex 应用程序内部处理 URL 路由,请参阅 Quickstart for PHP in the App Engine Flexible Environment

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      • 2019-04-24
      • 2018-11-28
      • 2017-09-30
      • 2018-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多