Insert file path error after PHP enabled session

Source: Internet
Author: User
I log in the background with the session, only use the background one login foreground index.php Insert File You will read the top.php in the background, not the top.php in the root directory. There is no problem locally. There is a problem on the server.
Both local and server are Win2003 + php5.2.5
I don't have an absolute path, it's all a relative path.


Reply to discussion (solution)

Require_once (' top.php ');
Top.php of the directory where the current file is loaded

Require_once (' top.php ');
Top.php of the directory where the current file is loaded



Now is not to load the current directory of top.php, loading is the background of the top.php

Give your directory structure

Put out the wrong tips and see

Put out the wrong tips and see


No prompt error, is called manage under the top.php

Directory structure:
/root directory
└---top.php
└---index.php
└---Manage (folder)
└---login.php
└---top.php
Inserted top.php in the index.php.
After logging in with login.php, accessing the index.php in the root directory will load manage/top.php instead of loading the root directory top.php
It's a strange question.

Master please come in and see what's going on!

Is the action for the login form not manage/login.php?

You're inside the index.php. GETCWD () print as current path look

You're inside the index.php. GETCWD () print as current path look


Returning the correct directory locally
Remote return: C:\WINDOWS\system32\inetsrv

Directory structure:
/root directory
└---top.php
└---index.php
└---Manage (folder)
└---login.php
└---top.php
Inserted top.php in the index.php.
After logging in with login.php, accessing the index.php in the root directory will load manage/top.php instead of loading the root directory top.php
It's a strange question.



When you visit index.php, if you use the Require words is right, because if it is require ("index.php") then it is quite the same as the current directory (login.php) in the top also imported, If it's not requrire, then I don't know what's going on.

Return the correct path with dirname (__file__), but still call top.php! under Manage

The problem is still not solved, but thank you all, see a part!
If anyone has a good idea, remember to contact me!

  • 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.