Absolute Path for Deployment in a Non-Root Location

后端 未结 8 1370
耶瑟儿~
耶瑟儿~ 2021-01-06 13:22

I typically refer to any assets on my site using absolute path so that I don\'t have to worry about the location of the assets relative to current file.

<         


        
8条回答
  •  一向
    一向 (楼主)
    2021-01-06 13:57

    I hate to say this but none of the above provides the solution. The answers by @Zoltan and @stslavik were close but, unfortunately, didn't work when deployed; I wished one of them worked, though.

    As a result, I resorted to using a combination of named constants and include files in PHP. More details: File Structure for a PHP Project. Note that it doesn't have to be PHP; you can use other languages that provide similar features. +1 for @margusholland whose answer led me to experiment with this solution.

提交回复
热议问题