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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:50:18  来源:igfitidea点击:

php register globals on/off through .htaccess

php.htaccessregister-globals

提问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 .htaccessyou 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.inia line to disable register_globals

我有一个像这样工作的登录脚本:用户输入用户名并通过,如果可以,则将用户数据保存在会话中并重定向到限制区域。我在 bluehost.com 上托管了我的网站,它运行良好。因此,出于某些原因,我决定更改为 hostgator.com 并且会话停止保存来自用户的数据。我所要做的就是添加到php.ini一行以禁用register_globals

register_globals=Off