📜  在 php 代码示例中评估 home tilde ~

📅  最后修改于: 2022-03-11 14:54:14.190000             🧑  作者: Mango

代码示例1
function expand_tilde($path)
{
    if (function_exists('posix_getuid') && strpos($path, '~') !== false) {
        $info = posix_getpwuid(posix_getuid());
        $path = str_replace('~', $info['dir'], $path);
    }

    return $path;
}