PHP ???? ?? ?? ???
1. ??? ???? ?? ??? ????
??? ??? ???? ???? ???? ?? ?????. ??? ???? ????? ?? ???? ??? ??? ??? ???? ?????. PHP? ?? ??? ?? ???? ??? ? ????
??: ?? ???? ???? ? ?????
2. ?? ?? ??
setcookie() ??? ?????. ?? ??
??: setcookie() ??? <html> ?? ?? ???? ???.
??: setcookie(name, value,expire, path, domain);
<?php setcookie("user", "admin", time()+3600); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>cookie</title> </head> <body> </body> </html>
??: ?? ??? ??? ??? admin ??? ??? ???? ?????. ?? ? ?? 1?? ?? ????? ?????.
??? ?? ??? ?? ???? ????? ???. ?? ??
<?php $time = time() + 60*60*3600; setcookie("user", "admin",$time); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>cookie</title> </head> <body> </body> </html>
?? ?? ???? ??
<?php setcookie("user", "admin", time()+3600); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>cookie</title> </head> <body> <?php echo $_COOKIE['user']; ?> </body> </html>
??: ??? admin ??? ???? ???? ? ??? ????, ????? ?????? ?? ??? ?? ???? ????.
?? ? ???? ?????? ??? ???? ?? ?????
4.
?? ?? ? ???? ???? ???. ?? ???? ??
<?php
//?? ?? ??? ?? 1???? ??
setcookie("user", "", time() -3600);
?>
?? ??? ????? ??? ??? ? ??? ???? ???? ? ?????. ???