Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

£Ûת£ÝÓÃPHPµÄob_start();¿ØÖÆÄúµÄä¯ÀÀÆ÷cache!


Output Control
º¯Êý¿ÉÒÔÈÃÄã×ÔÓÉ¿ØÖƽű¾ÖÐÊý¾ÝµÄÊä³ö¡£Ëü·Ç³£µØÓÐÓã¬ÌرðÊǶÔÓÚ£ºµ±ÄãÏëÔÚÊý¾ÝÒѾ­Êä³öºó£¬ÔÙÊä³öÎļþÍ·µÄÇé¿ö¡£Êä³ö¿ØÖƺ¯Êý²»¶ÔʹÓÃ
header()
»ò
setcookie(),
·¢Ë͵ÄÎļþÍ·ÐÅÏ¢²úÉúÓ°Ïì
,
Ö»¶ÔÄÇЩÀàËÆÓÚ
echo()
ºÍ
PHP
´úÂëµÄÊý¾Ý¿éÓÐ×÷Óá£
ÎÒÃÇÏȾÙÒ»¸ö¼òµ¥µÄÀý×Ó£¬Èôó¼Ò¶Ô
Output Control
ÓÐÒ»¸ö´óÖµÄÓ¡Ïó£º
Example 1.
CODE<?php
ob_start(); //
´ò¿ª»º³åÇø
echo \"Hellon\"; //
Êä³ö
header("location:index.php"); //
°Ñä¯ÀÀÆ÷Öض¨Ïòµ½
index.php
ob_end_flush();//
Êä³öÈ«²¿ÄÚÈݵ½ä¯ÀÀÆ÷
?>
Ëù
ÓжÔ
header()
º¯ÊýÓÐÁ˽âµÄÈ˶¼ÖªµÀ£¬Õâ¸öº¯Êý»á·¢ËÍÒ»¶ÎÎļþÍ·¸øä¯ÀÀÆ÷£¬µ«ÊÇÈç¹ûÔÚʹÓÃÕâ¸öº¯Êý֮ǰÒѾ­ÓÐÁËÈκÎÊä³ö£¨°üÀ¨¿ÕÊä³ö£¬±ÈÈç¿Õ¸ñ£¬»Ø
³µºÍ»»ÐУ©¾Í»áÌáʾ³ö´í¡£Èç¹ûÎÒÃÇÈ¥µôµÚÒ»ÐеÄ
ob_start()
£¬ÔÙÖ´Ðд˳ÌÐò£¬ÎÒÃǻᷢÏֵõ½ÁËÒ»Ìõ´íÎóÌáʾ£º
"Header
had all ready send by"
£¡µ«ÊǼÓÉÏ
ob_start
£¬¾Í²»»áÌáʾ³ö´í£¬Ô­ÒòÊǵ±´ò¿ªÁË»º³åÇø£¬
echo
ºóÃæµÄ×Ö·û²»»áÊä³öµ½ä¯ÀÀÆ÷£¬¶øÊDZ£ÁôÔÚ·þÎñÆ÷£¬Ö±µ½ÄãʹÓÃ
flush
»òÕß
ob_end_flush
²Å»áÊä³ö£¬ËùÒÔ²¢²»»áÓÐÈκÎÎļþÍ·Êä³öµÄ´íÎó£¡
Ò»¡¢
Ïà¹Øº¯Êý¼ò½é£º
1
¡¢
Flush
£ºË¢Ð»º³åÇøµÄÄÚÈÝ£¬Êä³ö¡£
º¯Êý¸ñʽ£º
flush()
˵Ã÷£ºÕâ¸öº¯Êý¾­³£Ê¹Óã¬Ð§Âʺܸߡ£
2
¡¢
ob_start
£º´ò¿ªÊä³ö»º³åÇø
º¯Êý¸ñʽ£º
void
ob_start(void)
˵Ã÷£ºµ±»º³åÇø¼¤»îʱ£¬ËùÓÐÀ´×Ô
PHP
³ÌÐòµÄ·ÇÎļþÍ·ÐÅÏ¢¾ù²»»á·¢ËÍ£¬¶øÊDZ£´æÔÚÄÚ²¿»º³åÇø¡£ÎªÁËÊä³ö»º³åÇøµÄÄÚÈÝ£¬¿ÉÒÔʹÓÃ
ob_end_flush()
»ò
flush()
Êä³ö»º³åÇøµÄÄÚÈÝ¡£
3
¡¢
ob_get_contents
£º·µ»ØÄÚ²¿»º³åÇøµÄÄÚÈÝ¡£
ʹÓ÷½·¨£º
string
ob_get_contents(void)
˵Ã÷£ºÕâ¸öº¯Êý»á·µ»Øµ±Ç°»º³åÇøÖеÄÄÚÈÝ£¬Èç¹ûÊä³ö»º³åÇøûÓм¤»î£¬Ôò·µ»Ø
FALSE
¡£
4
¡¢
ob_get_length
£º·µ»ØÄÚ²¿»º³åÇøµÄ³¤¶È¡£
ʹÓ÷½·¨£º
int ob_get_length(void)
˵Ã÷£ºÕâ¸öº¯Êý»á·µ»Øµ±Ç°»º³åÇøÖеij¤¶È£»ºÍ
ob_get_contents
Ò»Ñù£¬Èç¹ûÊä³ö»º³åÇøûÓм¤»î¡£Ôò·µ»Ø
FALSE
¡£
5
¡¢
ob_end_flush
£º·¢ËÍÄÚ²¿»º³åÇøµÄÄÚÈݵ½ä¯ÀÀÆ÷£¬²¢ÇҹرÕÊä³ö»º³åÇø¡£
ʹÓ÷½·¨£º
void
ob_end_flush(void)
˵Ã÷£ºÕâ¸öº¯Êý·¢ËÍÊä³ö»º³åÇøµÄÄÚÈÝ£¨Èç¹ûÓеĻ°£©¡£
6
¡¢
ob_end_clean
£ºÉ¾³ýÄÚ²¿»º³åÇøµÄÄÚÈÝ£¬²¢ÇÒ


Ïà¹ØÎĵµ£º

PHP³öÏÖWarning:Illegal offset type in

Warning
: Illegal offset type in
Warning
: Illegal offset type in isset or
empty in
Ç°¼¸Ììд³ÌÐòµÄʱºòÅöµ½Ò»¸öÕâÖÖ´íÎóÌáʾ
Èç¹ûÄãʹÓÃÕâÑùµÄ±íʾ·½·¨ÈçÏ£º
$arr = array();
class a
{
}
$o = new a;
echo $arr[$o];
¾Í»á³öÏÖÉÏÃæµÄ´íÎóÌáʾ£¬ÒòΪ²»ÄÜʹÓÃʵÀý»¯µÄ¶ÔÏóÀ´×÷ΪÊý×éµÄË÷Òý£¬»òÕßÔÚʹÓÃi ......

php ½âÎö excel ´æ´¢µ½ mysql ÂÒÂë


±àÂëÊǸöºÜ»ù´¡µÄÎÊÌ⣬ҲÊÇ´ó¼ÒºÜÈÝÒ׺öÂÔµÄÎÊÌ⣬д´úÂë֮ǰ¶à¶à¿¼ÂÇ£¬ÒÔºó»áÉٺܶàÂé·³¡£
PHP·¢Õ¹Á˲»ÉÙ£¬ÏÖÔÚpearÓÃÆðÀ´ºÜ·½±ã£¬ÆäÖоÍÓÐÏà¹ØµÄclassÀ´¶ÁÈ¡ExcelÎļþÀïÃæµÄÄÚÈÝ£¬Èç¹û²»ÏëʹÓÃpearµÄ»°£¬¿ÉÒÔ¿¼ÂÇʹÓÃexcel_class.php£¬googleһϣ¬¿ÉÒÔÕÒµ½Õâ¸öclassµÄsource codeÏÂÔØ£¬Ò²ÄÜÕÒµ½»ù±¾µÄexample c ......

PayPal PHP½Ó¿Ú paypalÔÚÏßÖ§¸¶


ÔÙ´Î֮ǰÏÈ˵һ¸öÍøÖ·£ºhttps://www.paypaltech.com/SG2/
            Õâ¸öÊÇÉú³Épaypal IPNµÄÍøÖ·£¬ÕâÑù˵°É£¬ÊÇÌæÄãÉú³É´úÂëµÄÍøÖ·(·Ç³£µÄºÃ)£¡²»¶®Ã»¹Øϵ£¡ÏÈÖªµÀһϣ¡ 
ÏÂÔؽ̳ÌÍøÖ·£ºhttp://download.csdn.net/source/2225766
http://download.cs ......

phpÔÚ2003SERVERϵÄÅäÖÃ

Ò»¡¢ÏµÍ³»·¾³¼°³ÌÐò˵Ã÷
1¡¢²Ù×÷ϵͳΪwindows server 2003
2 ¡¢iis°æ±¾Îª6.0
3¡¢php°æ±¾Îª5.2.9,¹Ù·½ÏÂÔصØÖ·: http://www.php.net/downloads.php
4¡¢mysql°æ±¾Îª5.1.34,¹Ù·½ÏÂÔصØÖ·:http://dev.mysql.com/downloads/mysql
¶þ¡¢°²×°iis
1¡¢²åÈëwindows server 2003ϵͳ°²×°¹âÅÌ
2¡¢¿ªÊ¼-¿ØÖÆÃæ°å-Ìí¼Óɾ³ý³ÌÐ ......

PHP autoload»úÖÆÏê½â

(1) autoload»úÖƸÅÊö
ÔÚʹÓÃPHPµÄOOģʽ¿ª·¢ÏµÍ³Ê±£¬Í¨³£´ó¼ÒÏ°¹ßÉϽ«Ã¿¸öÀàµÄʵÏÖ¶¼´æ·ÅÔÚÒ»¸öµ¥¶ÀµÄÎļþÀÕâÑù»áºÜÈÝÒ×ʵÏÖ¶ÔÀà½øÐи´Óã¬Í¬Ê±½«À´Î¬»¤Ê±Ò²ºÜ±ãÀû¡£ÕâÒ²ÊÇOOÉè¼ÆµÄ»ù±¾Ë¼ÏëÖ®Ò»¡£ÔÚPHP5֮ǰ£¬Èç¹ûÐèҪʹÓÃÒ»¸öÀֻ࣬ÐèÒªÖ±½ÓʹÓÃinclude/require½«Æä°üº¬½øÀ´¼´¿É¡£ÏÂÃæÊÇÒ»¸öʵ¼ÊµÄÀý×Ó£º
CODE:
/* ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ