简体   繁体   中英

Php, find out if the public folder is public_html or htdocs or www

Is there a way in php to find out what a public folder on the hosting is called? eg on some hosts its public_html, on others it's htdocs, others its simply www.

I'm, trying to write a script and I need to get this information to use later on.

eg I could use:

echo getcwd();

to get the full path but wondered if there is a way in php to just echo the public folder?

You can use the $_SERVER['DOCUMENT_ROOT'] to find out the public folder in system and it's give the only the path till the public folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM