How do I format a PHP include() absolute (rather than relative) path?

前端 未结 9 948
情书的邮戳
情书的邮戳 2020-12-06 04:48

On various pages throughout my PHP web site and in various nested directories I want to include a specific file at a path relative to the root.

What single command c

9条回答
  •  清歌不尽
    2020-12-06 05:06

    The tilde is interpreted as a special character by the shell, so using it inside PHP code won't work regardless of OS.

    If you're trying to access something relative to a user home directory you could try getenv() - I'm pretty sure Windows sets an environment variable equivalent to $HOME.

提交回复
热议问题