假设我有一个符号链接'/one/directory/'
to '/two/directory/'
.
If I echo dirname(dirname(\__FILE__))
,它返回'/one/directory/'
.
最好的退货方式是什么'/two/directory'
?
用法示例:
Vhost 'example.com'
指向“/two/directory”
example.com/hello_world.php
<?php
echo dirname(dirname(__FILE__));
?>
Returns: '/one/directory'
预期成绩: '/two/directory'
Use the readlink
功能?http://php.net/manual/en/function.readlink.php
您可以检查它是否是符号链接is_link
: http://php.net/manual/en/function.is-link.php
if (is_link($link)) {
echo(readlink($link));
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)