PHP - include in subdir not working

情到浓时终转凉″ 提交于 2019-12-08 08:54:07

问题


This is what I have

site.com/user/filehere.php

I need to go to

site.com/user/messages/index.php 

the index.php is

<?php 
include_once("../filehere.php");
?>

The problem is that inside filehere.php

there is another includes like

filehere.php

<?php  

include_once("../menu.php); 

?>

and these includes are not reconized in the /messages dir even when it's all ok when I acess directly the included file


回答1:


add __DIR__ to your file path to represent the current php dir. For more refer to this post.



来源:https://stackoverflow.com/questions/43917238/php-include-in-subdir-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!