PHP得到根目录
2010-04-27 文章来源:互联网 浏览次数:1222
分享文章
- <?php
- function get_root_path()
- {
- $s_real_path = realpath('./');
- $s_self_path = $_SERVER['PHP_SELF'];
- $s_self_path = substr($s_self_path, 0, strrpos($s_self_path, '/'));
- return substr($s_real_path, 0,strlen($s_real_path) - strlen($s_self_path));
- }
- echo get_root_path();
- ?>

文章评论(查看全部)