Get parent folder of current file PHP

后端 未结 5 1501
借酒劲吻你
借酒劲吻你 2020-12-29 05:09

I\'ve done quite a bit of searching for this, so I\'m sorry if this is a dupe.
Anyway, I need to get the name of the folder the current file is in. For example, I want

5条回答
  •  感动是毒
    2020-12-29 05:40

    You need to combine your existing code using dirname() with a call to basename():

    $parent = basename(dirname($_SERVER['PHP_SELF']));
    

提交回复
热议问题