Home > Article > Backend Development > PHP cookie names using dots (periods) will be converted, cookie periods_PHP Tutorial
This title is not very strict. It should be said that you can use a dot cookie name, but it will be converted. You name a cookie:
$_COOKIE['my.name'] = 1;
Actually you cannot find this value in the cookie via 'my.name', only 'my_name':
echo $_COOKIE['my_name'];
php has automatically converted it for you, and the period has been converted to an underscore.
Why does php do this? This is because of $_GET/$_POST/$_SERVER/$_COOKIE. . . The values of these global functions can be directly accessed locally through the register_globals parameter in many previous versions. For example, after turning on register_globals = on, accessing $my_name directly takes the value to 1. If it is $my.name, it does not comply with the PHP variable naming principle. This is not just a problem of periods (.).
Therefore, the naming of $_COOKIE already complies with the PHP naming standard.
Also turning on register_globals is a bad decision because it may overwrite the original value in the script, such as:
// other code
if ($a)
$uc_is_login = true;
// ...
Users only need to send an http request with url?a=1 to be logged in by default. This is a very dangerous practice and should be shut down. In fact, php6 has removed this option.
I often use it this way too. Ha ha. You asked the right person
Chinese status
on the keyboard. Can period. DEL on the small keyboard is the English dot. Very convenient
While holding down the ctrl key, press the period key [> key].
In this way, if you enter the punctuation and see, it will be Chinese punctuation.