有没有办法实现以下目标?
在我的 /www/var/public_html/index.php 文件中,我有这个
<?php include('database/connect.php'); ?>
然后在/www/var/public_html/database/connect.php,我想做这样的事情
<?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
?>
我不想 $my_path 打印 /www/var/public_html/
有没有一个PHP函数可以做到这一点?