6-2-2 ³]©wCookiesª«¥óªº¨Ï¥Î´Á
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-23
|
6-2-2 ³]©wCookiesª«¥óªº¨Ï¥Î´Á
6-2-2 ³]©wCookiesª«¥óªº¨Ï¥Î´Á
Y¥u«ü©wCookieª«¥ó¦WºÙ¨Ó¼g¤J¸ê®Æ¡A¦Ó¨S¦³¦b«ü©wCookiesª«¥óªº¦³®Ä´Á¡A«hCookieª«¥ó±N¥u¦s¦b©óÂsÄý¾¹¤§¤¤¡A·íÂsÄý¾¹Ãö³¬«áCookieª«¥ó´N®ø·À¤F¡C
Cookieª«¥óªº¥Í©R¶g´Á°_©l©óÂsÄý¾¹³Q°õ¦æ®É¡C²×¤î©óÂsÄý¾¹µ²§ô°õ¦æ®É¡C¨º¦pªG§ÚÌn©µªøCookies ª«¥óªº¥Í©R¶g´Á©O¡HYn©µªøCookie ª«¥óªº¥Í©R¶g´Á§ÚÌ¥i¥t¥Î¡yExpires¡z°Ñ¼Æ¨Ó³]©wCookiesªº¥Í©R¶g´Á¡]Expiresªí¥¢®Ä¡^¡A¦p¤U©Ò¥Ü:- setcookie(¡§¦WºÙ¡¨, ¡¨¸ê®ÆÈ¡¨,¡¨¦s¬¡´Á¡¨);"
½Æ»s¥N½X ¨Ò¦p¡G¨Ï¥Îtime()¨ç¼Æ¨ú±o®É¶¡ÂW°O¡]¦Û01/01/1970¤é°_¨ì¥Ø«eªº¤é´Á®É¶¡¬í¼Æ¡^¥[¤WCookie ª«¥óªº¥i¦s¬¡¬í¼Æ¡G- //¦b10¤ÀÄÁ(600¬í)«á®ø·À
- setcookie("myname","charles",time()+600);
- //¦b3600¬í«á®ø·À
- setcookie("myname","charles",time()+3600);
½Æ»s¥N½X nÅýCookie¦b¯S©wªº¤é´Á®É¶¡®ø·À¡A³o®É¥i§ï¥Îmktime()¨ç¼Æ¨Ó°µ¡Amktime()¨ç¼Æ®æ¦¡¦p¤U¡G
mktime() ¨ç¼Æ®æ¦¡- int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]])
½Æ»s¥N½X ¨Ï¥Îmktime()¨ç¼Æ³]©wCookie¨ì´Á®É¶¡¡G- //¦b2009¦~1¤ë1¤é®ø·À
- setcookie("myname","charles",mktime(0,0,0,1,1,2009));
- //¦b2010¦~10¤ë5¤é¤W¤È10ÂI®ø·À
- setcookie("myname","charles",mktime(10,0,0,10,5,2010));
½Æ»s¥N½X |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|
¡@¼ÊºÙ: ¤p»x ¡@ÀY»Î: ´¿¸g¤]¬O¤ô¹q¤u
ºÞ²zû
- ©«¤l
- 1190
- ¥DÃD
- 394
- ºëµØ
- 113
- ¿n¤À
- 1747
- ÂI¦W
- 1
- §@·~¨t²Î
- Vista
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 200
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2024-11-23
|
¹ê°µ¾Ç²ß2¡G
©µÄò¹ê°µ¾Ç²ß1¡A¬°Cookies ª«¥ó«Ø¥ß¨Ï¥Î´Á¡AÃÒ©úCookies ª«¥ó½T¹ê¬OÀx¦s¦bÂsÄý³s½uªÌªºÂsÄý¾¹¤§¤¤¡C
ex6_6.php- <?
- ob_start();
- if (!isset($_COOKIE["mynum"]))
- {
- echo "³o¬O±z²Ä1¦¸¨Ó";
- $life = mktime(10,0,0,10,5,2010);
- setcookie("mynum",1,$life);
- }
- else
- {
- $num=$_COOKIE["mynum"];
- $num++;
- echo "³o¬O±z²Ä " . $num . "¦¸¨Ó<br>";
- $life = mktime(10,0,0,10,5,2010);
- setcookie("mynum",$num,$life);
- }
- ?>
½Æ»s¥N½X ±Ò°ÊÂsÄý¾¹¡A¶}©lÂsÄýex6_6.php¡A¦¹®É§Ú̱N·|µo²{¦b¡yC:\Documents and Settings\XXX\ Local Settings\Temporary Internet Files¡z¥Ø¿ý¤¤ªº§Ö¨ú°O¾Ð¤¤¤£¦ý¦³½d¨Òex6_6ªºµ{¦¡ºô¶¼È¦sÀÉ¡A¦P®ÉÁÙ¦h¥XCookie ªºª«¥óÀɮסI³o¦¸¦]¬°§Ú̦³³]©wCookieª«¥óªº¨ì´Á¤é¬°Cookieª«¥ó¨Ï¥Î«á¨ì¥¢®Ä´Á¤º¤º³£¦³®Ä¡A¦]¦¹¡A¸ÓCookieª«¥ó·|¥H¤@Ó¤å¦rÀɮתº®æ¦¡¦s¦b©óÂsÄý¾¹¤¤¡C
¹Ï6-10 ¤å¦rÀɮ׮榡ªºCookie°O¿ýÀÉ¡C
´£¥Ü!!©Ò¦³ªºCookieÀɮ׳£¦³¤@Ó¹w³]ªººô°ì»P¸ô®|¡A¥u¦³«Ø¥ß¦¹Cookieªººô°ì»P¸ô®|¤~¯à¦s¨ú³oÓCookieÀɮסC |
|
¤ß¦w¡A¥¦w
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!
|
|
|
|
|