php ²»ÓÃCOM Éú³ÉexcelÎļþ
ÓÃphpÉú³ÉexcelÎļþ
<?
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
?>
¡¡¡¡ÔÚphp»·¾³ÔËÐÐÉÏÃæµÄ´úÂ룬´ó¼Ò¾Í¿ÉÒÔ¿´µ½ä¯ÀÀÆ÷ѯÎÊÓû§ÊÇ·ñÏÂÔØexcelÎĵµ£¬µã»÷±£´æ£¬Ó²ÅÌÉϾͶàÁËÒ»¸öexcelµÄÎļþ£¬Ê¹ÓÃexcel´ò¿ª¾Í»á¿´µ½×îÖյĽá¹û£¬ÔõôÑù²»´í°É¡£
¡¡¡¡ÆäʵÔÚ×öÕæÕýµÄÓ¦ÓõÄʱºò£¬´ó¼Ò¿ÉÒÔ½«Êý¾Ý´ÓÊý¾Ý¿âÖÐÈ¡³ö£¬È»ºó°´ÕÕÿһÁÐÊý¾Ý½áÊøºó¼Ó/t,ÿһÐÐÊý¾Ý½áÊøºó¼Ó/nµÄ·½·¨echo³öÀ´£¬ÔÚphpµÄ¿ªÍ·ÓÃheader("Content-type:application/vnd.ms-excel");±íʾÊä³öµÄÊÇexcelÎļþ£¬ÓÃheader("Content-Disposition:filename=test.xls");±íʾÊä³öµÄÎļþÃûΪtext.xls¡£ÕâÑù¾ÍokÁË¡£
¡¡¡¡ÎÒÃǸü¿ÉÒÔÐÞ¸ÄheaderÈÃËûÊä³ö¸ü¶à¸ñʽµÄÎļþ£¬ÕâÑùphpÔÚ´¦Àí¸÷ÖÖÀàÐÍÎļþ·½Ãæ¾Í¸ü¼Ó·½±ãÁË£®
Ïà¹ØÎĵµ£º
$_SERVER´æ´¢µ±Ç°·þÎñÆ÷ÐÅÏ¢£¬ÆäÖÐÓм¸¸öÖµÈç$_SERVER["QUERY_STRING"]£¬$_SERVER["REQUEST_URI"]£¬$_SERVER["SCRIPT_NAME"]ºÍ$_SERVER["PHP_SELF"]³£³£ÈÝÒ×»ìÏý£¬ÒÔÏÂͨ¹ýʵÀýÏê½â$_SERVERº¯ÊýÖÐQUERY_STRING£¬REQUEST_URI£¬SCRIPT_NAMEºÍPHP_SELF±äÁ¿Çø±ð£¬ÕÆÎÕÕâËÄÕßÖ®¼äµÄ¹ØÏµ£¬±ãÓÚÔÚʵ¼ÊÓ¦ÓÃÖÐÕýÈ·»ñÈ¡ËùÐèÒªµÄÖµ
1£ ......
http://blog.csdn.net/hahawen/archive/2004/05/01/20692.aspx
Èý¡¢ÊµÏÖÄãµÄMode²ã
Model²ã£¬¾ÍÊÇMVCģʽÖеÄÊý¾Ý´¦Àí²ã£¬ÓÃÀ´½øÐÐÊý¾ÝºÍÉÌÒµÂß¼µÄ×°·â£¬½øÐÐËûµÄÉè¼ÆµÄʱºòÉè¼Æµ½Èý¸ö¸ö¸ÅÄî:
------ModelÀà¡£ÊÇʵÌåÀà¡£ÓÃÀ´±£´æÊý¾Ý¿â±í¸ñµÄÖÐÒ»Ìõ¼Ç¼µÄËùÓÐ×ֶεÄÊý¾Ý¡£²¢ÇÒ¿ÉÒÔÑéÖ¤ÕâÌõ¼Ç¼Êý¾ÝµÄÍêÕûÐÔ¡£
------ ......
ºÜÈÙÐÒÉÏÆªÎÄÕ±»°æÖ÷ÍÆ¼öµ½Ê×Ò³ÁË£¬ÐÄÀïËãÊǼ¤¶¯ÁËÒ»°Ñ£¬¼ÌÐøÅ¬Á¦Ñ§Ï°Öаɡ£±¾ÕÂÖ÷Òª½éÉÜPHPÖеıäÁ¿¡£Ö÷Òª°üÀ¨£ºÔ¤¶¨Òå±äÁ¿¡¢±äÁ¿·¶Î§¡¢¿É±ä±äÁ¿ÒÔ¼°PHPµÄÍⲿ±äÁ¿µÈ¡£
Ò»¡¢»ù´¡ÖªÊ¶
PHP ÖÐÒ»¸öÃÀÔª·ûºÅºóÃæ¸úÉÏÒ»¸ö±äÁ¿Ãû³Æ£¬¼´±íʾһ¸ö±äÁ¿¡£±äÁ¿µÄÃû³ÆÊǶԴóСдÃô¸ÐµÄ¡£
±äÁ¿ÃûÓë PHP ÖÐÆäËüµÄ±êǩһÑù×ñÑÏàͬµÄ ......
ѧ¹ýCµÄÈËÓÃphpµÄʱºòÒ»°ã»áÏ൱˳ÊÖ£¬¶øÇҸе½phpÌ«·½±ãÌ«ÇáËÉ¡£µ«ÔÚ±äÁ¿×÷ÓÃÓòÕâ·½ÃæÈ´Óë
cÓв»Í¬µÄµØ·½£¬¸ã²»ºÃ»áÏ൱ÓôÃÆ£¬¾ÍÕÒ²»µ½´íÎóËùÔÚ¡£×òÍí¾ÍÓëµ½Õâôһ¸öÎÊÌ⣬ÊÇÈ«¾Ö±äÁ¿ÔÚº¯ÊýÖеÄÎÊÌâ¡£½ñÌìËÑË÷ÁËһϣ¬·¢ÏÖһƪÏ൱²»´íµÄÎÄÕ£¬½²ÁËphpÖеıäÁ¿×÷ÓÃÓò¡£ÊÇÒ»Î»ÍøÓÑ·ÒëµÄ ÔÚÕâÌùһϣº
±äÁ¿·¶Î§
±äÁ¿µÄ·¶ ......
ͨ³£¿ª·¢ÈËÔ±ÔÚд³ÌÐòµÄʱºò£¬ÍùÍùÊǰÑÒѾÉè¼ÆºÃ»òÕß¹¹Ë¼ºÃµÄÔËËãÂß¼£¬Ö±½ÓÓñà³ÌÓïÑÔ·Òë³öÀ´¡£³ÌÐòÄÜ˳Àû±àÒëͨ¹ý£¬ÄÇÊǺÜÁîÈ˸ßÐ˵ÄÊÂÇé¡£Èç¹û´Ëʱ³ÌÐòµÄÔËÐÐʱ¼ä»¹ÄܽÓÊÜ£¬¾Í»á³Á½þÔÚд´úÂëµÄ³É¾Í¸Ðµ±ÖУ¬³£³£ÔÚÕâ¸ö¹ý³ÌÖкöÂÔ´úÂëµÄÓÅ»¯¡£Ö»Óе±³ÌÐòÔËÐÐËÙ¶ÈÊܵ½Ó°Ïìʱ£¬²Å»Ø¹ýÍ·È¥¿¼ÂÇÓÅ»¯µÄÊÂÇé¡£
ʲôÊÇËã·¨µÄʱ ......