您的位置主页 > 编程专区 > Php > PHP得到根目录

PHP得到根目录

2010-04-27    文章来源:互联网    浏览次数:1222     分享文章

 

 
  1. <?php
  2. function get_root_path()
  3. {
  4.     $s_real_path = realpath('./');
  5.     $s_self_path = $_SERVER['PHP_SELF'];
  6.     $s_self_path = substr($s_self_path, 0, strrpos($s_self_path'/'));
  7.     return substr($s_real_path, 0,strlen($s_real_path) - strlen($s_self_path));
  8. }
  9.  
  10. echo get_root_path();
  11. ?>

 

文章评论(查看全部)

昵 称 *
电子邮箱 *
网 址      7 + 8 = ?