Require_once need to be aware of the problem and set the include path

Source: Internet
Author: User
Set up common Files to include: (Under Project root)

include.php

<?php    Header ("Content-type:text/html;charset=utf-8");    Date_default_timezone_get ("PRC");    Session_Start ();    _file_ returns the full (absolute) path of the file where the current code resides (rather than the URL)    //dirname ($file _name) returns the $file_name layer directory name    define ("ROOT", DirName ( FILE));    Set_include_path ("."). Path_separator. ROOT. " /core ". Path_separator. ROOT. " /configs ". Path_separator.get_include_path ());    Require_once ' mysql.func.php ';    Require_once ' image.func.php ';    Require_once ' common.func.php ';    Require_once ' string.func.php ';    Require_once ' page.func.php ';    Require_once ' configs.php ';    Require_once ' admin.inc.php ';    Require_once ' cate.inc.php ';    Require_once ' pro.inc.php ';    Require_once ' album.inc.php ';    Require_once ' user.inc.php ';    Require_once ' upload.func.php ';    Connect ();? >


Then, the other pages directly require_once ('./include.php ')//path relative to include.php

However, there is a problem with file nesting

Here is a detailed explanation of the specific

Click to open link

So, for the sake of insurance, it's best

Require_once (DirName (FILE). ' /'.'.. /include.php ');

and start with DirName (FILE). ' /'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.