[英]How include file file.php in another file.php
Suppose to have two file, home1.php
and home2.php
in different folders. 假设在不同的文件夹中有两个文件
home1.php
和home2.php
。 This is folder disposition: 这是文件夹的配置:
root
folder1
home1.php
folder2
home2.php
I need to include home1.php
in home2.php
so in home2.php I do: 我需要包括
home1.php
在home2.php
所以在home2.php我做的:
<?php include('../folder1/home1.php'); ?>
But it give me file not found
.Anyone can help me? 但这给了我
file not found
有人可以帮助我吗?
也许您可以尝试通过回显$ _SERVER ['DOCUMENT_ROOT']。'folder1 / home1.php'进行调试?
尝试
<?php include(dirname(__FILE__)."/../folder1/home1.php"); ?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.