[英]Google App Engine, can people download my source code?? (with PHP)
I'm new to GAE, and have big doutbts on how it works. 我是GAE的新手,对它的工作方式有很大的怀疑。 Mainly the app.yaml configuration file.
主要是app.yaml配置文件。 If i have this structure for example:
例如,如果我有此结构:
/
/index.php
/scripts/script.php
On app.yaml I should write something like this for example (the basic to work), right? 在app.yaml上,我应该编写类似这样的内容(工作的基础知识),对吗?
application: myapp
version: 1
runtime: php
api_version: 1
handlers:
- url: /
script: index.php
- url: /scripts/script.php
script: scripts/script.php
Is this correct? 这个对吗? And if i have a lot of scripts on the scripts directory, should i put an entry for all of them?
并且如果我在scripts目录中有很多脚本,是否应该为所有这些脚本输入一个条目?
I ask this (I think its a really stupid question but i want to be sure) because i have realised that if i put the scripts directory as a static_dir, like: 我问这个问题(我认为这是一个非常愚蠢的问题,但是我想确定),因为我已经意识到,如果我将脚本目录作为static_dir放置,例如:
- url: /scripts
static_dir: scripts
... if i go to the URL of that file ( http://mydomain.com/scripts.script.php ) i can download the source code. ...如果我转到该文件的URL( http://mydomain.com/scripts.script.php ),则可以下载源代码。
So I guess that static_dir is not for accessing a whole directory's content, and as it's name says... is just for static content like photos for example, right? 因此,我猜想static_dir不是用于访问整个目录的内容的,正如它的名字所说的那样……仅用于静态内容(例如照片),对吗? so for each script i should write a line on the app.yaml to be accesible?
所以对于每个脚本,我都应该在app.yaml上写一行以确保可访问性?
Sorry about my stupid question, my english is not so good and i'm new at this so i have this doutbt ;) 对不起我的愚蠢问题,我的英语不太好,我对此很陌生,所以我有点怀疑;)
Thanks a lot in advance! 在此先多谢!
You can find some detailed examples here of PHP and app.yaml here: https://developers.google.com/appengine/docs/php/config/appconfig 您可以在此处找到一些有关PHP和app.yaml的详细示例: https : //developers.google.com/appengine/docs/php/config/appconfig
If you have a large number of *.php files that you want to make executable, you can use wildcards. 如果您要使大量* .php文件成为可执行文件,则可以使用通配符。 For example:
例如:
- url: /(.+\.php)$
script: \1
Will map anything URL ending in .php to the equivalent filepath. 将以.php结尾的所有URL映射到等效的文件路径。 So
所以
http://myapp.appspot.com/some/directory/file.php
will map to 将映射到
some/directory/file.php
in your app's directory. 在您应用的目录中。
Don't put anything in static
directories that you don't want the world to see. 不要在您不希望世界看到的
static
目录中放置任何内容。 static
directories are intended as a fast shortcut for serving things like images, CSS, and JavaScript. static
目录旨在用作提供图像,CSS和JavaScript之类的服务的快捷方式。
.php files (or .py files if you're using Python) need to be 'executed' (evaluated) on the server (App Engine) side. .php文件(如果您使用的是Python,则为.py文件)需要在服务器(App Engine)端“执行”(评估)。 Putting them in a
static_dir
puts them out of reach of the execution environment, which isn't what you want. 将它们放在
static_dir
会使它们超出执行环境的范围,这不是您想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.