The PHP cookie name uses the dot number (period) to be converted

Source: Internet
Author: User
Tags http request

This title is not very strict, it should be said that you can use the dot number of the cookie name, but will be converted, you name a cookie:

$_cookie[' my.name '] = 1;

You can't actually find this value in a cookie by ' my.name ', Only ' my_name ':

echo $_cookie[' My_name '];

PHP has been automatically converted for you, and the period turns to underline.

Why does PHP do this? This is because $_get/$_post/$_server/$_cookie ... The values of these global functions, in many previous versions, can be accessed directly locally via the register_globals parameter, such as when register_globals = On is opened, and the access $my_name takes a direct value of 1. If it is $my.name, then does not conform to the PHP variable naming principle, this is not just a period (.) The problem.

Therefore, the naming of $_cookie has already met the PHP naming standard.

Opening register_globals is a bad decision because it may overwrite the original values in the script, such as:

Other code

if ($a)

$uc _is_login = true;

// ...

Users only need to send a url?a=1 HTTP request can be logged by default. This is a very dangerous practice and should be turned off. In fact, PHP6 has removed this option.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.