ÕaÑuµÄÓi¾a£¬ºÜÏÔÈ»,Ôi³ÉÕa¸oÔÒoÊÇÒoΪsetcookieÔi³ÉµÄ,²eÁËÒ»ÏÂÍøÉÏ,ÓÐÈçϵĽaÊÍ: cookie±¾ÉiÔÚʹÓÃÉÏÓÐÒ»Ð(C)ÏÞÖÆ£¬ÀýÈ磺
1.ºo½ÐsetcookieµÄ"¢Êo±ØišÅÔÚ±eÇ(C)֮ǰ
2.ºo½Ðsetcookie֮ǰ£¬²»¿ÉʹÓÃecho
3.Ö±µ½¾Wi"±»ÖØÐÂÝdÈeaa£¬cookie²Å•þÔÚ³ÌʽÖгo¬F
4.setcookieº¯Êý±ØišÔÚÈκÎÙYÁÏÝ"³oÖÁa¯ÀÀÆ÷Ç°£¬¾ÍÏÈËͳo
5.¡¡
»ui¶ÉÏÃaeß@Ð(C)ÏÞÖÆ£¬ËuÒÔˆÌÐÐsetcookie£¨£(C)º¯Êýʱ£¬³£•þÅoµ½"Undefined index"¡¢"Cannot modify header information - headers already sent by"¡µÈ†-i}£¬½a›Q"Cannot modify header information - headers already sent by"Õa¸oaeÕ`µÄ½¨ÊÇÔÚ²uÉucookieÇ°£¬ÏÈÑÓ»ºÙYÁÏÊa³oÖÁa¯ÀÀÆ÷£¬Òo´Ë£¬Äu¿ÉÒÔÔÚ³ÌʽµÄ×iÇ°½¼ÓÉÏob_start£¨£(C)£»Õa¸oº¯"µ¡£ÕaÑu¾Í¿ÉÒÔ½a¾o ÁË¡£ Èç¹uÒª¼ÓÉÏob_start£¨£(C)µÄ»°,²»´o¿ÉÐÐ,³ÌÐo¶¼Ð´ÍeÁË,²ÅÀ´¸ÄÕa¸oËƺoÓеaÓoÃÆ.. *¢ÏÖÌaʾÕa¸o´iÎoµÄʱºo,ÎÒ¾ÍÔÚÏeÎÒ±¾µØÔoôûÌaʾÕa¸oÎÊÌaÄØ,»¹ÒÔΪÊÇPHP.iniÅaÖò»Ò»Ñu,ÏeÏeÓÖ²»¶Ô,¶¼ÊDzi²»¶aµÄ..
ÓÚÊÇ¿´¿´ºoÃae¸uµÄÄǾa"output started at...."Òa˼ÊÇÔÚsetcookie֮ǰÒѾÔÚÁiÒ»´¦ÓÐÊa³oÁË,ÓÚÊÇÕÒµ½output started atºoÃae¸uµÄÄǸoÎļþ,¿´µ½µÚÒ»ÐÐÊÇ¿Õ°×µÄ,È»ºo²ÅÊÇ<?php ÕaÑu¿ªÊ¼,ÄѵÀ»aÊÇÕaÒ»ÐеÄÎÊÌaÂð??ÎÒ±¾µØÒ²ÓÐÕaÒ»ÐÐÄØ,È¥µo,Ë¢ÐÂÔÙÊÔ,ºÇºÇ,¹uÈ»³oÔÚÕaÀi,²»ÔÙÌaʾwarningÁË
½a¾oÍe±Ï!
½a¾o½¨¶þ£º
²eÕÒÍøÉϽa¾o´ËÎÊÌaµÄ½¨¶aÊÇÒ»ÑuµÄ£¬²»¹ý½ñÌiÓÖÓoµ½ÁËÕaÑuµÄÎÊÌa¡£ÊÔ¹ýÖ®ºo*¢ÏÖ¿ÉÐУº
ÔÚCÅ̵ÄWINDOWSÖÐÕÒµ½php.ini Õa¸oÅaÖÃÎļþ£¬È»ºo²eÕÒÒ»Ïi£ºoutput_buffering½«ÆaÖµÓÉÔÀ´µÄoff¸ÄΪon£¬ÖØÐÂÆo¶¯Apache¾ÍokÁË¡£