PHPµÄrealpath(...)
PHPµÄrealpath(...)
Author:zfive5(zidong)
Email :zfive5@yahoo.com.cn
Òý×Ó£º
×òÌì°ïÈ˸ÄÁËÒ»ÏÂPHP³ÌÐò£¬ÔÚÅäeclipse+php(xdebug)+mysql+apacheºó£¬¾ÍÏÝÈëÒ»²½²½Âþ³¤¶ø·¦Î¶µÄµ÷ÊÔÖУ¬ËäÈ»¹¤¾ßÓÐЩ²»Ì«ºÃÓ㨵«Ò²¶Ôphp»·¾³9ÄêÀ´µÄ½ø²½¸Ðµ½ÐË·Ü£©£¬ ÔÚÕû¸öµ÷ÊÔ¹ý³ÌÖУ¬·¢ÏÖ×Ô¼ºÍêÈ«ÈÃrealpath(...)´øÈëÁ˹µÀ1¸ö¶àСʱѽ£¡ÎªÁËÕâÒ»¸ö1СʱҲ¸Ãдµãʲô³öÀ´£¡
ÕýÎÄ£º
PHP realpath() º¯Êý
¶¨ÒåºÍÓ÷¨
realpath() º¯Êý·µ»Ø¾ø¶Ô·¾¶¡£
¸Ãº¯Êýɾ³ýËùÓзûºÅÁ¬½Ó£¨±ÈÈç '/./', '/../' ÒÔ¼°¶àÓàµÄ '/'£©£¬·µ»Ø¾ø¶Ô·¾¶Ãû¡£
Èôʧ°Ü£¬Ôò·µ»Ø false¡£±ÈÈç˵Îļþ²»´æÔڵĻ°¡£
Óï·¨
readlink(linkpath)
²ÎÊý ÃèÊö
linkpath ±ØÐè¡£¹æ¶¨Òª¼ì²éµÄÁ¬½Ó·¾¶¡£
˵Ã÷
ÔÚ BSD ϵͳÉÏ£¬Èç¹û½ö½öÊÇ linkpath ²»´æÔڵĻ°£¬PHP ²¢²»»áÏñÆäËüϵͳÄÇÑù·µ»Ø false¡£
Ŀ¼½á¹¹£º
WebSite
|
|--1.php
|
|--txt11
| |--2.php
1.php:
<?php
require("./txt/2.php")
output "1.php ·¾¶:".realpath("./")."<br/>";
?>
2.php:
<?php
output "2.php ·¾¶:".realpath("./")."<br/>";
?>
ä¯ÀÀÆ÷Ö´ÐÐÈçÏ£º
http://localhost:8080/1.php
http://localhost:8080/txt/2.php
require() ËùÖ¸¶¨ÒýÈëµÄÎļþ(2.php)£¬Ê¹Ëü±ä³ÉPHP³ÌÐòÍøÒ³(1.php)µÄÒ»²¿·Ý,ËùÒԲŻá³öÏÖ²»Í¬£¬¸öÈ˸оõΪÁ˱ÜÃârealpath Óë require »ìÓôøÀ´µÄ²»È·¶¨ÐÔ£¬½¨ÒéʹÓÃ$_SERVE['DOCUMENT_ROOT']
ǰЩÌ죬¿´ÁËÒ»±¾¡¶°®Éϵ¥Æ¬»ú¡·£¬¸Ð¾õÌ«ÉñÆ棡
½ñÌì½èÁËÁ½±¾Ê顶WCF¡·ºÍ¡¶SiliverLight¡··½ÃæµÄÊ飬¼ÌÐø......
ÓÐÁ½±¾Ê顶¸ßÐÔÄÜÍøÕ¾½¨ÉèÖ¸ÄÏ¡·ºÍ¡¶¸ßÐÔÄÜÍøÕ¾½¨Éè½ø½×Ö¸ÄÏ¡·£¬ ¾ø¶ÔµÄºÃÊ飬¼ò½àÃ÷ÁË£¡
¸Ð¿®ÊéµêºÃ¶àÊ飬Õâ¸öÈëÃÅÄǸöÉîÈëË®·ÖÌ«¶à£¬Ã¿ÄêÉÙ³ö¼¸±¾ÕâÑùµÄÊ飬¿Ï¶¨Òª±ÈÒ»µ½3.12¾ÍÈ«Ìå³ö
¶¯È¥ÖÖÊ÷ÒªºÃµÄ¶à¡£
 
Ïà¹ØÎĵµ£º
×î½üµÄphp°æ±¾ºÃÏñÒѾµ½ÁË5.3°É£¬Óв»ÉÙ¶«Î÷¶¼³öÏÖÁ˱仯£¬´Ó5.3¿ªÊ¼£¬ÎªÁ˸üºÃµÄÏòδÀ´°æ±¾µÄphp£¨°æ±¾6£©¹ý¶É£¬½«Î´À´²»ÔÙÖ§³ÖµÄº¯Êý±ê¼Ç³ÉÁËdeprecated¡£ÔÚ´úÂëÖÐʹÓÃÕâЩº¯Êý£¬½«ÔÚÒ³ÃæÖÐÏÔʾ¾¯¸æÐÅÏ¢¡£
±ä¸ü£º
ÅäÖÃÎļþǨÒÆ
PHP 5.3 ¿ªÊ¼£¬ÅäÖÃÎļþ php.ini ÖеÄһЩÅäÖý«»áÔÚ PHP Ö´ÐÐʱÏÔʾ¹ýʱ¾¯¸æ£¬ÕâЩÅäÖý ......
Èç¹ûÄúÉÐδ´òËãÓà OO ÔÔò´´½¨Ó¦ÓóÌÐò£¬ÔòʹÓà PHP µÄÃæÏò¶ÔÏó£¨OO£©µÄÓïÑÔÌØÐÔ£¬Õâ 7 ¸öÏ°¹ß½«°ïÖúÄú¿ªÊ¼ÔÚ¹ý³Ì±à³ÌÓë OO ±à³ÌÖ®¼ä½øÐÐת»»¡£
ÔÚ PHP ±à³ÌÔçÆÚ£¬PHP ´úÂëÔÚ±¾ÖÊÉÏÊÇÏÞÓÚÃæÏò¹ý³ÌµÄ¡£¹ý³Ì´úÂë µÄÌØÕ÷ÔÚÓÚʹÓùý³Ì¹¹½¨Ó¦ÓóÌÐò¿é¡£¹ý³Ìͨ¹ýÔÊÐí¹ý³ÌÖ®¼äµÄµ÷ÓÃÌṩijÖ̶ֳȵÄÖØÓá£
µ«ÊÇ£¬Ã»ÓÐÃæÏò¶ÔÏóµÄÓï ......
1.ÏÂÔØ°²×°mcrypt
ÏÈÈ¥http://www.sourceforge.netÏÂÔØLibmcrypt,mhash,mcrypt°²×°°ü
2 .ÏÈ°²×°Libmcrypt
#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install
˵Ã÷£ºlibmcriptĬÈÏ°²×°ÔÚ/usr/local
3.°²×°mhash
#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./ ......
PHP»º´æ¼¼ÊõÏê½â
Ò»¡¢»º´æ¼¼Êõ:
ÓÐЩÐÅÏ¢±È·½¾³£²»±äµÄ,µ«ÊÇ»¹ÊÇÄܱäµÄÐÅÏ¢·ÅÔÚ»º´æÖÐÒÔ¼Ó¿ìÏÔʾËÙ¶È,ÕâÊǺÜÓмÛÖµµÄ,ËùνµÄ»º´æ,ͨË×µÄÀí½â¾ÍÊÇһЩ±£´æÔÚ·þÎñÆ÷¶ËµÄ¹²ÓÃЊϢ.ËüÊÇÓÚ·þÎñÆ÷ͬÉúËÀµÄ,ÎÒÃÇÔÚ±£´æ»º´æµÄʱºò¿ÉÒÔÖ¸¶¨Ï´θüеÄʱ¼äµÄÅжÏ,±È·½ÒªÔÚ5·ÖÖÓ¸üÐÂÒ»´Î,¿ÉÒԼǼÉϴθüеÄʱ¼ ......
PHP»·¾³ÅäÖÃÐĵÃ
ApacheµÄÅäÖÃ
Ê×ÏÈÎÒÔÚhttp://httpd.apache.org/download.cgiϵÄÊÇ“Win32 Binary without crypto (no mod_ssl) (MSI Installer): httpd-2.2.15-win32-x86-no_ssl.msi”¡£°²×°ÄÇÊÇС¶ù¿ÆÀ²£¬ÏÂÒ»²½ÏÂÒ»²½¡£ÎҾͲ»ËµÁË¡£
°²×°Íêºó¾ÍÒª¿ªÊ¼ÅäÖÃÁË£¬ ......