How to get the absolute path to the public_html folder?

后端 未结 11 1346
离开以前
离开以前 2020-12-08 14:25
$_SERVER[\'DOCUMENT_ROOT\']

returns

/usr/local/apache/htdocs/

is there a way to get

/home/us         


        
11条回答
  •  离开以前
    2020-12-08 15:08

    with preg_replace function to find absolute path from __FILE__ you can easily find with anything home user. Here short my code :

    $path_image_you_want = preg_replace('#/public_html/([^/]+?)/.*#', '/public_html/$1/images", __FILE__);

提交回复
热议问题