0
有没有办法达到以下目的?包含的PHP脚本的脚本路径?
在我/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函数来做到这一点?