PHPÖÐÓÐÐi¶aÓeÎļþϵͳÓйصĺ¯Êý£¬ÕaÐ(C)º¯Êý²»½o¿ÉÒÔ´o¿ªÎļþ£¬»¹¿ÉÒÔÏÔʾĿ¼ÖеÄÄÚÈÝ¡¢Òƶ¯ÎļþºÍÆaËuÒ»Ð(C)¹¦ÄÜ£¬Ði¶aÈËÉoÖÁÓÃPHP¿ª*¢»uÓÚ»¥ÁªÍøµÄÎļþ×ÊÔ´¹ÜÀiÆ÷¡£
ÏÂÃaeµÄ½Å±¾ÑuÀý¿ÉÒÔÏÔʾһ¸oĿ¼Çaµ¥£¬×¢ÊÍÒѾ°uº¬ÔÚ´uÂeÖУº
£¼? /ª³°ÑÒª¶ÁÈ¡µÄĿ¼µÄȫ¾¶Ãu´aeÈeÒ»¸oÃu×ÖΪ$dir_nameµÄ±aÁ¿ÖС£/
$dir_name = "/home/me/";
/ª³ ´´½¨Ò»¸o¾a±u£¬ÆaÖµÊÇ´o¿ªÒ»¸o¸ø¶¨Ä¿Â¼µÄ½a¹uª³/
$dir = opendir($dir_name);
/ª³ ½¨Á¢Ò»¸oÎÄ×Ö¿e£¬ÓÃÒÔÅÖÃÁбiÔªËØ£¨ÎļþÃu×Ö£(C)ª³/
$file_list = "£¼ul£¾";
/ª³ ʹÓÃÒ»¸owhileÓi¾a£¬¶ÁÈ¡ÒѾ´o¿ªµÄĿ¼ÖеÄËuÓÐÔªËØ£¬Èç¹uÎļþµÄÃu×Ö²»ÊÇ¡°.¡±»o¡°..¡±£¬ÔoÏÔʾÁбiÖеÄÃu×Ö/
while ($file_name = readdir($dir)) {
if (($file_name != ".") &&&& ($file_name != "..")) {
$file_list .= "£¼li£¾$file_name";
}
}
$file_list .= "£¼/ul£¾";
/ª³¹Ø±Õ´o¿ªµÄĿ¼£¬½aÊøPHPÄ£¿eª³/
closedir($dir);
?£¾
£¼!-- Start your HTML --£¾
£¼HTML£¾
£¼HEAD£¾
£¼TITLE£¾Directory Listing£¼/TITLE£¾
£¼/HEAD£¾
£¼BODY£¾
£¼!-- Use PHP to print the name of the directory you read --£¾
£¼P£¾Files in: £¼? echo "$dir_name"; ?£¾£¼/p£¾
£¼!-- Use PHP to print the directory listing --£¾
£¼? echo "$file_list"; ?£¾
£¼/BODY£¾
£¼/HTML£¾
ºÃÁË£¬ÎÒÃÇÒѾµÃµ½ÁËÒ»¸oĿ¼Çaµ¥¡£ÐeҪעÒaµÄÊÇ£¬Òª¶ÁÈ¡Ò»¸oÎļþ£¨ÉÔºoÎÒÃǽ«½øÐн²½a£(C)»oĿ¼µÄÄÚÈÝ£¬PHPÔËÐеÄϵͳÉϵÄÓû§±ØÐeÖÁÉÙÓжÁÈ¡ÎļþµÄȨÏÞ¡£
ÏÂÃaeÊÇÒ»¸oÈçºÎ¿½±´ÎļþµÄÀý×Ó£º
£¼? /ª³°ÑÄaÒª¿½±´µÄÔ´ÎļþµÄȫ¾¶¸³¸øÒ»¸oÃu×ÖΪ$originalµÄ±aÁ¿ÖУ¬°Ñ¿½±´µÄÎļþµÄȫ¾¶¸³ÓeÒ»¸oÃu×ÖΪ$copiedµÄ±aÁ¿ÖЪ³/
$original = "/home/me/mydatabasedump";
$copied = "/archive/mydatabasedumo_1010";
/ª³ ʹÓÃcopy()º¯Êý¿½±´Ô´Îļþ£¬Èç¹u¿½±´Ã»ÓÐÍe³ÉÔo»aÏÔʾһ¸o´iÎoÐÅÏ¢ª³/
@copy($original, $copied) or die("Couldn't copy file.");
?£¾
Õa¸oÀý×ÓÊÇÒ»¸oÎļþ±¸*ÝϵͳµÄÔÐÍ¡£ÔÚÕa¶Î½Å±¾ÔËÐÐʱ£¬Ëu°ÑÎļþ¿½±´µ½Ò»¸o²»Í¬µÄλÖýøÐб£´ae¡£ÉÔ΢ÐÞ¸ÄÒ»ÏÂÊØ»¤³ÌÐo£¬¾Í¿ÉÒÔÔÚÒ»ÌiÖÐÄaÖ¸¶¨µÄʱ¿ÌÖ´ÐÐËu£¬¶øÎÞÐeÓû§µÄ¸ÉÔ¤¡£
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8