包含PHP脚本的脚本路径?

Joh*_*ohn 0 php relative-path

有没有办法实现以下目标?

在我的/www/var/public_html/index.php文件中,我有这个

<?php include('database/connect.php'); ?>
Run Code Online (Sandbox Code Playgroud)

然后在/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
?>
Run Code Online (Sandbox Code Playgroud)

我不希望$ my_path打印/ www/var/public_html /

有这样的PHP函数吗?