简体   繁体   中英

How include file file.php in another file.php

Suppose to have two file, home1.php and home2.php in different folders. 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:

<?php include('../folder1/home1.php'); ?>

But it give me file not found .Anyone can help me?

也许您可以尝试通过回显$ _SERVER ['DOCUMENT_ROOT']。'folder1 / home1.php'进行调试?

尝试

<?php include(dirname(__FILE__)."/../folder1/home1.php"); ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM