Strange! About Cookies !! $ Str = 'abc'; on one page, I write: setcookie (& quot; dede_cmp & quot;, $ str); on the other page, write: echo $ _ COOKIE ['dede _ cmp ']; but nothing is output. why ?, PHPcodese is strange! About Cookies !!
$ Str = 'abc ';
On a page, I wrote: setcookie ("dede_cmp", $ str );
Write another page: echo $ _ COOKIE ['dede _ cmp '];
But nothing is output. why?
------ Solution --------------------
PHP code
Setcookie (name, value, expire, path, domain, secure) set the Expiration time // send a cookiesetcookie ("TestCookie", $ value, time () that expires 24 hours a day () + 3600*24 );
------ Solution --------------------
Oh. It is also a disaster caused by 360. Try it in another browser.
------ Solution --------------------
Notice: Undefined index: error?
------ Solution --------------------
Use live http headers or firebug in firefox
"I wrote: setcookie (" dede_cmp ", $ str);" on a page );"
Whether the http headers of this page has the setcookie header
------ Solution --------------------
Do not have any html output before setcookie, such as echo.
It is best to use a separate php page setcookie
------ Solution --------------------
Discussion
Do not have any html output before setcookie, such as echo.
It is best to use a separate php page setcookie
------ Solution --------------------
Print_r ($ _ REQUEST );
Print_r ($ _ COOKIE );
If there is no, there is no. In addition, firefox can directly view cookies.
------ Solution --------------------
Isset () try to see if it is set