开发者

The Script Path of an included PHP script?

Is there a way to achieve the following?

In my /www/var/public_html/index.php file i have this

<?php include('database/connect.php'); ?>

And then in /www/var/public_html/database/connect.php, I want to do something like this

<?php

$my_path = get_path_of_current_script(); // should not be path of index.php
echo $my_path;
// should print
// /www/var/public_html/database
?>

I don't want $my_path to p开发者_C百科rint /www/var/public_html/

Is there a PHP function to do this?


$my_path = dirname(__FILE__);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜