0

我已经在 php 中创建了一个应用程序。文件夹“myapp-test-1”有一个名为 index.php 的文件和一个文件夹 CSS,其中包含文件 main.css,这是 index.php 的 css 文件。我正在尝试创建我的应用程序 yaml 文件以上传我在谷歌应用引擎中的项目。这是我的 app.yaml 文件:

application: myapp-test-1  
version: 1
runtime: php
api_version: 1

handlers:

- url: /.*
  script: index.php

- url: /css
  static_dir: css

- url: /css/
  script: main.css

在浏览器中测试时,似乎 index.php 文件未满载。此外 index.php 的 css 不工作。

4

2 回答 2

5

你需要有

- url: /.*
  script: index.php

最后,因为如果你先拥有它,GAE 读取这个文件的顺序是这个,然后是其他两个 css。.*旁边的正则表达式url表示所有 URL 都将指向index.php,因此将其放在最后将允许 GAE 首先读取 css 的。你也不需要包括

- url: /css/
  script: main.css

如果您只想在 index.php 中加载 css 文件。

所以总的来说,它应该看起来像

application: myapp-test-1  
version: 1
runtime: php
api_version: 1

handlers:

- url: /css
  static_dir: css

- url: /.*
  script: index.php
于 2014-12-25T21:28:14.880 回答
0

我相信你应该试着只留下:
- url: /.*
script: path/index.php

并删除对 css 的两个引用。

从 index.php 内部,确保使用正确的路径调用 css 文件。最终,如果您使用 firefox,“检查元素”功能和控制台会告诉您为什么您的文件未加载...

祝你好运

于 2014-12-25T18:22:34.933 回答