php 通过 .htaccess 打开/关闭注册全局变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3716852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php register globals on/off through .htaccess
提问by yarek
I have 2 scritpts on 2 different folders. One on them need the register globals to On and the other to Off.
我在 2 个不同的文件夹中有 2 个脚本。其中一个需要寄存器全局变量为 On,另一个需要为 Off。
Is it possible to enable regsiter globals on one folder and disable it on another one ? (maybe with a .htaccess ?)
是否可以在一个文件夹上启用注册全局变量并在另一个文件夹上禁用它?(也许带有 .htaccess ?)
regards
问候
回答by knittl
if your apache instance allows you to override flags through .htaccess
you can put the following in your file:
如果您的 apache 实例允许您通过覆盖标志,.htaccess
您可以将以下内容放入您的文件中:
php_flag register_globals off
回答by Vinicius
I have a login script that works like this:
User type username and pass, if ok then save user data in a session and redirect to restrict area. I hosted my site in bluehost.com and it works perfectly.
So for some reasons I've decided to change to hostgator.com and session stopped save data from user. All I have to do is add to php.ini
a line to disable register_globals
我有一个像这样工作的登录脚本:用户输入用户名并通过,如果可以,则将用户数据保存在会话中并重定向到限制区域。我在 bluehost.com 上托管了我的网站,它运行良好。因此,出于某些原因,我决定更改为 hostgator.com 并且会话停止保存来自用户的数据。我所要做的就是添加到php.ini
一行以禁用register_globals
register_globals=Off