我有一个剧本可以生成一个化身。这是我的结构:
-folder1
-scripts
-MakeAvatar.php
-img
-avatar我把它用在其他页面上,比如:
$name = 'anything';
$hash = md5($name);
$input = "http://localhost/folder1/scripts/MakeAvatar.php?hash=$hash";
$output = "../../folder1/img/avatar/".$name.".jpg";
file_put_contents($output, file_get_contents($input));正如你所看到的,每个人都可以访问这个脚本并制作一个化身:
http://localhost/folder1/scripts/MakeAvatar.php?hash=$hash我怎么能只为我自己的网站贡献这个脚本而禁止其他人使用它呢?
发布于 2016-04-25 17:23:37
将脚本放置在web根目录之外。
scripts
-MakeAvatar.php
public (or whatever you call your webroot)
-img
-index.php这意味着www.site.com会转到index.php,但是您无法从浏览器导航到脚本。但是,您可以通过执行:../scripts/MakeAvatar.php (来自index.php)。
https://stackoverflow.com/questions/36847008
复制相似问题