【问题标题】:gcloud deploy php applicationgcloud 部署 php 应用程序
【发布时间】:2017-01-24 13:21:33
【问题描述】:

我想使用以下文件夹结构在谷歌云上上传和运行我的 php 应用程序:

yaml 文件如下所示:

runtime: php55
api_version: 1

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

- url: /css
  static_dir: css

当我部署它时,它运行 index.php 文件,但不附加任何 css 或 js 文件。 yaml 文件的结构应该是什么,以便它接受 css 和 js 文件夹中的 css 和 js 文件?

谢谢

【问题讨论】:

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


    【解决方案1】:

    试试这个(处理程序的顺序很重要)

    application: <your-app-id-goes-here>
    runtime: php55
    api_version: 1
    
    handlers:
    
    - url: /css
      static_dir: css
    
    - url: /js
      static_dir: js
    
    - url: /images
      static_dir: images
    
    - url: .*
      script: index.php
    

    【讨论】:

    • 嗨@Tom,感谢您的回答。是的,处理程序的顺序很重要。我想使用另一个 php 文件(脚本)来发出 ajax 请求。我在 index.php 的处理程序下方添加了以下内容: - url: /api script: api.php 但它不起作用。你知道原因吗?
    • “.*”处理程序必须在最后。在其上方添加您的 AJAX 处理程序?
    猜你喜欢
    • 1970-01-01
    • 2018-02-23
    • 1970-01-01
    • 2018-05-22
    • 1970-01-01
    • 1970-01-01
    • 2020-10-25
    • 1970-01-01
    • 2020-01-14
    相关资源
    最近更新 更多