PHP pass variable to include

前端 未结 13 2843
你的背包
你的背包 2020-11-27 17:19

I\'m trying to pass a variable into an include file. My host changed PHP version and now whatever solution I try doesn\'t work.

I think I\'ve tried every op

13条回答
  •  一生所求
    2020-11-27 18:02

    In regards to the OP's question, specifically "The variable needs to be set and evaluated from the calling first file (it's actually '$_SERVER['PHP_SELF']', and needs to return the path of that file, not the included second.php)."

    This will tell you what file included the file. Place this in the included file.

    $includer = debug_backtrace();
    echo $includer[0]['file'];
    

提交回复
热议问题