Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand that PHP register_ globals are on and off

2025-04-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to understand PHP register_globals value is on and off", in daily operation, I believe many people have doubts on how to understand PHP register_globals value is on and off, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation method, hope to answer "how to understand PHP register_globals value is on and off" doubts helpful! Next, please follow the small series to learn together!

The value of register_globals can be set to either On or Off. Let's take a code to describe the difference between them.

Code:

The copy code is as follows:

When register_globals=Off, the next program to receive should receive the value with $_GET <$'user_name'] and $_GET <$'user_pass']. (Note: $_POST <$'user_name') and $_POST <$'user_pass') should be used when the method attribute is post.

When register_globals=On, the next program can accept values directly using $user_name and $user_pass.

Register_globals, as the name suggests, means to register as a global variable, so when On, the value passed in will be registered directly as a global variable, and when Off, we need to go to a specific array to get it. So, those of you who have problems with getting values above should first check that your register_globals setting matches the way you get values. (This can be done with phpinfo() or by looking directly at php.ini)

Let's see what's wrong here.

Take a look at this PHP script that grants access to a Web page when the username and password are entered correctly:

The copy code is as follows:

Please enter your username and password:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report