【问题标题】:Google Apps Engine PHP - how to hide included scriptsGoogle Apps Engine PHP - 如何隐藏包含的脚本
【发布时间】:2015-03-16 01:13:10
【问题描述】:

假设有这个 index.php

<$php
include_once("dictionary.php");
...
$>

必须如何定义 app.yaml 以上传“dictionary.php”但以不公开的方式? (下面的例子让用户浏览http://mydomain/dictionary.php,这是我们要避免的)

application: myGAEphpapp
version: 1
runtime: php
api_version: 1
threadsafe: yes

handlers:

- url: /    
  script: /index.php

- url: /dictionary\.php    
  script: /dictionary.php

【问题讨论】:

  • 你为什么把它作为一个处理程序放在首位? include_once 不是在服务器端工作,因此没有必要将其公开?
  • 我不明白你的问题:如果你不在 app.yaml 上声明,你如何将 dictionaty.php 上传到 GAE 服务器?
  • 您目录中的所有内容都将被上传。
  • 明白了。那么为什么存在“static_files”和app_readable声明呢?
  • 静态文件的目的是将它们移动到 CDN,因此它们将无法从您的应用程序中使用,但请求也不会到达您的服务器。

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


【解决方案1】:

我发现的唯一方法是在获取所有请求的句柄之后定义非公开脚本

application: myGAEphpapp
version: 1
runtime: php
api_version: 1
threadsafe: yes

handlers:

- url: /    
  script: /index.php

[...]

**- url: /.*
  script: /catchall_script.php**

#never triggered but serverside available
- url: /dictionary.\php
  script: /dictionary.php

【讨论】:

  • 这完全没用,如果你不能点击一个 url,那么有一个处理程序是没有意义的。只需删除它,一切都会正常工作。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-06-30
  • 1970-01-01
  • 2018-10-21
  • 1970-01-01
相关资源
最近更新 更多