【问题标题】:Google App Engine (PHP) - How to include javascriptGoogle App Engine (PHP) - 如何包含 javascript
【发布时间】:2013-07-14 21:43:43
【问题描述】:

我在 LAMP 服务器上使用 PHP 制作了网站,现在我想把它放在 GAE 上,但它似乎无法识别 javascript。这是我的 yaml 文件:

application: helloworld
version: 1
runtime: php
api_version: 1

handlers:
- url: /stylesheets
  static_dir: stylesheets

- url: /.*
  script: index.php

- url: /js
  static_dir: js

然后在html中我像这样加载它:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="js/script.js"></script>

请帮忙

【问题讨论】:

    标签: php javascript google-app-engine


    【解决方案1】:

    在 app.yaml 文件中,将执行第一个匹配的 URL 正则表达式。由于您在 /js 上方有 catch all .* 表达式,因此它将匹配请求。

    把你app.yaml的顺序改成

    handlers:
    
    - url: /stylesheets
      static_dir: stylesheets
    
    - url: /js
      static_dir: js
    
    - url: /.*
      script: index.php
    

    【讨论】:

    • 它仍然无法正常工作,有什么我必须放入 javascript 文件以使其在 GAE 上运行。一切都在 LAMP 上完美运行。
    • 我修好了,我忘了为另一个我需要的 .js 文件创建处理程序。谢谢
    猜你喜欢
    • 2011-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-07
    • 1970-01-01
    • 2013-01-28
    • 1970-01-01
    • 2011-07-15
    相关资源
    最近更新 更多