Á˽âÈçºÎʹÓà PHP µÄ¸÷ÖÖÎļþº¯Êý
·¢ÐÅÈË: feuvan ( }><(([@> ~ ), ÐÅÇø: PHP
±ê Ìâ: [ÈëÃÅ]Óà PHP ¶ÁÈ¡ÎļþµÄÕýÈ··½·¨
·¢ÐÅÕ¾: ˮľÉçÇø (Wed Mar 7 17:51:58 2007), Õ¾ÄÚ
http://www.ibm.com/developerworks/cn/opensource/os-php-readfiles/index.html
Óà PHP ¶ÁÈ¡ÎļþµÄÕýÈ··½·¨
Á˽âʹÓà fopen¡¢fclose¡¢feof¡¢fgets¡¢fgetss ºÍ fscanf µÄÕýȷʱ»ú
¼¶±ð: Öм¶
Roger McCoy (rogermccoy@gmail.com), IT Specialist, ×ÔÓÉ׫¸åÈË
2007 Äê 3 ÔÂ 06 ÈÕ
Á˽âÈçºÎʹÓà PHP µÄ¸÷ÖÖÎļþº¯Êý¡£²é¿´ÖîÈç fopen¡¢fclose ºÍ feof Ö®ÀàµÄ»ù±¾Îļþº¯Êý£»Á˽âÖîÈç fgets¡¢
fgetss ºÍ fscanf Ö®ÀàµÄ¶ÁÈ¡º¯Êý¡£²¢ÇÒ·¢ÏÖÓÃÒ»Á½ÐдúÂë´¦ÀíÕû¸öÎļþµÄº¯Êý¡£
ÈÃÎÒÃÇËãÒ»ËãÓжàÉÙÖÖ·½·¨
´¦ÀíÖîÈç PHP Ö®ÀàµÄÏÖ´ú±à³ÌÓïÑÔµÄÀÖȤ֮һ¾ÍÊÇÓдóÁ¿µÄÑ¡Ïî¿ÉÓá£PHP ¿ÉÒÔÇáËɵØÓ®µÃ Perl µÄ×ùÓÒÃú
“There's more than one way to do it”£¨²¢·ÇÖ»ÓÐÒ»ÖÖ·½·¨¿É×öÕâ¼þÊ£©£¬ÓÈÆäÊÇÔÚÎļþ´¦ÀíÉÏ¡£µ«ÊÇÔÚÕâô¶à¿ÉÓõÄÑ¡
ÏîÖУ¬ÄÄÒ»ÖÖÊÇÍê³É×÷ÒµµÄ×î¼Ñ¹¤¾ß£¿µ±È»£¬Êµ¼Ê´ð°¸È¡¾öÓÚ½âÎöÎļþµÄÄ¿±ê£¬Òò´ËÖµµÃ»¨Ê±¼ä̽¾¿ËùÓÐÑ¡Ïî¡£
»ØÒ³Ê×
´«Í³µÄ fopen ·½·¨
fopen ·½·¨¿ÉÄÜÊÇÒÔÇ°µÄ C ºÍ C++ ³ÌÐòÔ±×îÊìϤµÄ£¬ÒòΪÈç¹ûÄúʹÓùýÕâЩÓïÑÔ£¬ÄÇôËüÃÇ»ò¶à»òÉÙ¶¼ÊÇÄúÒÑÕÆÎÕ¶àÄêµÄ¹¤¾ß¡£¶ÔÓÚÕâЩ·½·¨ÖеÄ
ÈκÎÒ»ÖÖ£¬Í¨¹ýʹÓà fopen£¨ÓÃÓÚ¶ÁÈ¡Êý¾ÝµÄº¯Êý£©µÄ±ê×¼·½·¨´ò¿ªÎļþ£¬È»ºóʹÓà fclose ¹Ø±ÕÎļþ£¬ÈçÇåµ¥ 1 Ëùʾ¡£
Çåµ¥ 1. Óà fgets ´ò¿ª²¢¶ÁÈ¡Îļþ
$file_handle = fopen("myfile", "r");
while (!feof($file_handle)) {
$line = fgets($file_ha
Ïà¹ØÎĵµ£º
ÔÚPHPÖУ¬ÎļþÉÏ´«Ò»°ãÊÇͨ¹ýmove_uploaded_file£¨£©À´ÊµÏֵġ£
bool move_uploaded_file ( string filename, string destination )±¾º¯Êý¼ì²é²¢È·±£ÓÉ filename Ö¸¶¨µÄÎļþÊǺϷ¨µÄÉÏ´«Îļþ£¨¼´Í¨¹ý PHP µÄ HTTP POST ÉÏ´«»úÖÆËùÉÏ´«µÄ£©¡£Èç¹ûÎļþºÏ·¨£¬Ôò½«ÆäÒƶ¯ÎªÓÉ destination Ö¸¶¨µÄÎļþ¡£
Èç¹û filename ²»ÊǺϷ ......
¡¡¡¡“¼¼ÊõÎÊÌⶼÊÇ¿ÉÒÔ½â¾öµÄ£¬¼¼ÊõÎÊÌâ²»ÊÇ×î×îÖØÒªµÄ”
¡¡¡¡ ×î½ü°ï¹ýһЩÈ˽â¾ö¼¼ÊõÎÊÌ⣬·¢ÏÖÒ»¸öºÜÑÏÖصÄÎÊÌ⣬ËûÃǵÄ×ö·¨ºÍÎÒ×ʼд³ÌÐòµÄʱºòÊÇÒ»ÑùµÄ£¬ÕâÑùÏÂÈ¥»á×ߺöàµÄÍä·¡£ÏÖÔÚÓÐÒ»Àà³ÌÐòԱ̫¶à£¬ËûÃÇ×ÜÊÇһζµÄ×·Çó“ËùνµÄ¼¼ÊõÄѵ㔣¬×ÜÊÇ°ÑÐÄÊ·ÅÔÚһЩ±ß±ß½Ç½ÇµÄ“³ÌÐò´úÂë ......
Ò»¡¢ ½¨Á¢Ò»¸ö°²È«³éÏó²ã
¡¡¡¡ÎÒÃDz¢²»½¨ÒéÄãÊÖ¹¤µØ°ÑÇ°Ãæ½éÉܵļ¼ÊõÓ¦ÓÃÓÚÿһ¸öÓû§ÊäÈëµÄʵÀýÖУ¬¶øÊÇÇ¿ÁÒÍƼöÄãΪ´Ë´´½¨Ò»¸ö³éÏó²ã¡£Ò»¸ö¼òµ¥µÄ³éÏóÊÇ°ÑÄãµÄУÑé·½°¸¼ÓÈëµ½Ò»¸öº¯ÊýÖУ¬²¢ÇÒÕë¶ÔÓû§ÊäÈëµÄÿһÏîµ÷ÓÃÕâ¸öº¯Êý¡£µ±È»£¬ÎÒÃÇ»¹¿ÉÒÔ´´½¨Ò»ÖÖ¸ü¸´Ôӵĸü¸ßÒ»¼¶µÄ³éÏó-°ÑÒ»¸ö°²È«µÄ²éѯ·â×°µ½Ò»¸öÀàÖУ¬´Ó¶øÓ¦ ......
<?php
/* ----------------------------------------------------------------------------
* Script Name: encrypt.php
* Creation Date: 2008-4-7 10:36
* Last Modified: 2008-4-12 16:00
* Author: meyu
* Copyright (c) 2007
* Purpose: Êý×Ö×Ö·û´®¼òÒ×¼Ó½âÃÜ
* --------------------------------- ......
×÷Ϊһ¸ö×ÊÉî²¢ÇÒרҵµÄ°ÇƤÈËÔ±£¬ÔÚÎÒ´Ó³õÈý¿ªÊ¼Í¶Èëΰ´óµÄ»¥ÁªÍøÖе½ÏÖÔÚ»ýÀÛÁ˷ḻµÄ°ÇƤ¾Ñé¡£ÎÒÏàÐÅÿ¸ö×öwebµÄ³ÌÐòÔ±Ò²¶¼»áÓÐÀàËƵľÀú¡£
ÔÚ°ÇƤ¹ý³ÌÖУ¬±Ø²»¿ÉÉÙµÄÐèÒªÏÂÔØÑùʽÎļþÖеÄͼƬ¡£Åöµ½±È½ÏÅÓ´óµÄÑùʽÎļþ£¬ÆäÖпÉÄÜ»áÓÐÉÏ°Ù¸öÐèÒªÏÂÔصÄͼƬ£¬ÄÇôʹÓÃÏÂÃæÕâ¶ÎС´úÂëÊÇ×îΪºÏ
ÊʵÄÁË¡£
< ?php
/* ......