Search code examples
phppathfilesystemsrootrequire-once

How can I specify the filesystem absolute path in a require_once in PHP?


Simply put, how do I specify an absolute filesystem path using the require_once keyword in PHP? The code will be run in CLI, not on a webpage. What is the root file path? I am running Windows, FYI.

Thank you.


Solution

  • On windows, it's the backslash notation, also you have to escape them if you are using double quotes.

    require_once("C:\\folder\\folder\\etc");