Php $ _ COOKIE simple application instance. COOKIE is before the webpage content is sent. The information sent first. That is to say. Before that, there cannot be any HTML code or echo, and even a space is not allowed .. COOKIE is before the webpage content is sent. The information sent first. That is to say. Before that, there cannot be any HTML code or echo, and even a space is not allowed ..
Cookie is before the webpage content is sent. The information sent first. That is to say. Before that, there cannot be any html code or echo, and even a space is not allowed ..
In the php Tutorial, you must use the setcookie function to register the cookie variable. the above code does not register the cookie variable. How can it be delivered. The correct syntax is as follows:
*/
$ Status = 0; // define the status
If (isset ($ _ cookie ['mytacky ']) & ($ _ cookie ['mytacky'] = "chocchip") $ status = 1; // if the variable has been set
If (! Isset ($ _ get ['cchk']) // if no variable is set
{
Setcookie ("mytstcky", "chocchip"); // send cookie information
Header ("location: $ php_self? Cchk = 1 "); // send the header
Exit; // end the php code
}
?>
Cookie check
Cookie check status:
Printf ('% s
; ', $ Status? "00ff00": "ff0000", $ status? "Passed! ":" Failed! "); // Output different content according to the condition
?>
Http://www.bkjia.com/PHPjc/631354.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/631354.htmlTechArticleCOOKIE is before webpage content is sent. The information sent first. That is to say. No HTML code or echo can be found before this, and even a space is not allowed .....