phpµã»÷ÏÂÔØtxtÎļþ
ÓÉÓÚÏÖÔÚµÄä¯ÀÀÆ÷ÒѾ¿ÉÒÔʶ±ð¸ñʽΪtxtµÄÎĵµ¸ñʽ£¬ËùÒÔÈç¹ûÖ»ÊǸøtxtÎĵµ×öÒ»¸öÎÄ×ÖÁ´½ÓµÄ»°£¬¿ÉÄÜÖ»ÊÇ´ò¿ªÒ»¸öд°¿ÚÏÔʾtxtÎļþµÄÄÚÈÝ£¬²¢²»ÄÜʵÏÖµã»÷ÏÂÔØµÄÄ¿µÄ¡£We have to do something else.
µ±È»Õâ¸öÎÊÌâµÄ½â¾ö°ì·¨Ò²¿ÉÒÔÊÇÄ㽫ÄãµÄtxtÎļþ¸ÄÃûΪä¯ÀÀÆ÷²»ÈÏʶµÄÎļþ£¬±ÈÈçrar,ÕâÑùµÄ»°µã»÷£¬ä¯ÀÀÆ÷²»ÈÏʶ¾ÍÖ»ºÃÈÃÓû§ÏÂÔØÁË¡£
ÏÂÃæÕâ¸öÎļþ¾ÍÊÇͨ¹ýÉèÖÃheaderÉèÖÃÎĵµµÄ¸ñʽÀ´ÊµÏÖµã»÷ÏÂÔØµÄÄ¿µÄ£¬½«ÉϸöÒ³Ãæ´«µÝ¹ýÀ´µÄÎļþµã»÷¿ÉÒÔÏÂÔØ¡£
<?php
$filename = "/somepath/".$_GET['file'].".txt"; //ÒªÏÂÔØµÄÎļþÃû
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($filename));
readfile($filename);
?>
Ê×ÏÈ£ºÉèÖÃContent-TypeµÄֵΪapplication/force-download£¬Ç¿ÖÆÏÂÔØ£¿ÊÇÕâ¸öÒâ˼Âð£¿
½Ó×ŵڶþ¸öheaderº¯ÊýÉèÖÃÁËÒªÏÂÔØµÄÎļþ£¬×¢ÒâÕâÀïfilenameÊDz»°üº¬Â·¾¶µÄÎļþÃû£¬ËùÒÔÓÃbasename¹ýÂ˵ô·¾¶Ãû¡£Õâ¸öfilenameµÄÖµ½«À´¾ÍÊǵã»÷ÏÂÔØºóµ¯³ö¶Ô»°¿òÀïÃæµÄÎļþÃû£¬Èç¹û´øÂ·¾¶µÄ»°£¬µ¯³ö¶Ô»°¿òµÄÎļþÃû¾ÍÊÇδ֪µÄ£¬Õâ¸öҪעÒ⣬ÎҾͷ¸ÁËÕâ¸ö´íÎ󣬺óÀ´Æ¾¾Ñé×Ô¼º¸ÄÁË£¬¾ÓÈ»¶ÔÁË¡£
×îºó¾ÍÊÇreadfile£¬½«ÎļþÁ÷Êä³öµ½ä¯ÀÀÆ÷£¬ÕâÑù¾ÍʵÏÖÁËtxtÎļþµÄÏÂÔØ£¬ÆäËûÀàÐ͵ÄÀàËÆ¡£
Ïà¹ØÎĵµ£º
/*** Function: PHP header() examples (PHP)
**
Desc: Some examples on how to use the header() function of PHPYou find
a detailed tutorial at expertsrt.com (English) or at ffm.junetz.de
(German).These is also a good help about caching at web-caching.com.
**
Example: see below.
<br/& ......
×¢Òâ:ÒýÓÃ"·ÊÕ¼µÄ²©¿Í http://fatjames.extjs.org.cn/archives/40"
mysql5.x sql-mode ÒýÆðµÄ´íÎó
½ñÌì°²×°Á˸ömysql5.0,ÄÃÁËÒ»¸öºÜ¾ÃÖ®Ç°ÍøÉÏϵijÌÐò¼ì²éÒ»ÏÂÊÇ·ñ¹¤×÷Õý³£.
·¢ÏÖÒÔǰµÄ³ÌÐò¾ÓÈ»²»ÄÜÕý³£ÔËÐÐ,ÌáʾÐÅÏ¢ÈçÏÂ:
Database error: Invalid SQL: INSERT INTO
Survey_UserHistory(userId,jobId,type ......
<?PHP
$word = new COM("word.application") or die("Can't start Word!");
// print the version of Word that's now in use
echo "Loading Word, v. {$word->Version}";
// set the visibility of the application to 0 (false)
// to open the application in the forefront, use 1 (true)
$word->Visibl ......
ÕæµÄÊDz»Óò»ÖªµÀ£¬ÆäʵÎÒÃÇÊìϤµÄ PHP »¹ÓкܶàºÃ¶«Î÷ûÓз¢¾ò¡£¿´
µ½ÕâÆªÎÄÕÂ
£¬µ±Ê±¾ÍÀá±¼Á˺ü¸»Ø£¬ÖصãÍÆ¼öÏ£¬Ë³±ãÎÒ×Ô¼ºÒ²×ö¸öÕûÀí¡£
sys_getloadavg()
Õâ¸öº¯Êý
·µ»Øµ±Ç°ÏµÍ³µÄ¸ºÔؾùÖµÐÅÏ¢
£¨µ±È» Windows
ϲ»ÊÊÓã©£¬ÏêϸÎĵµ¿ÉÒÔ·ÔÄ PHP µÄÏà¹ØÎĵµ¡£ÎĵµÖÐÓжÎʾÀý´úÂ룬»ù±¾ÉÏÒ²¾ÍÄÜ¿´³öËüµÄÓÃ;ÁË¡ ......