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Ö̶ֳȵÄÖØÓá£
µ«ÊÇ£¬Ã»ÓÐÃæÏò¶ÔÏóµÄÓï ......
»ù±¾Óï·¨
ÎҵĵÚÒ»¸öPHP£ºHello World
<?php
echo"Hello World!";
?>
ÏÔʾ½á¹ûΪ Hello World!
±äÁ¿
PHPÖУ¬ËùÓеıäÁ¿¶¼ÒÔ±êʶ“$”¿ªÍ·:
<?php
$str1 = "Hello World!";
echo $str1;
?>
ÏÔʾ½á¹ûΪ Hello World!
PHPÖÐʹÓÓ.”·ûºÅÁ¬½Ó²»Í¬µÄ×Ö·û´®¡£¾ÙÀýÈçÏ£º
<?p ......
·½·¨1£ºerror_reporting (E_ALL ^ E_WARNING);
session_start();
·½·¨2£ºerror_reporting (E_ALL & ~E_NOTICE);
if (!isset($_SESSION)) {
session_start();
};
·½·¨3£º¸Äphp.ini ÖÐerror_reporting ......