An error occurred while php-include_once-include_once contains php file

Source: Internet
Author: User
Write a small exercise. the directory structure is as follows: viewuseruserRegister. php sends a post request to serviceuseruserRegister. phpuserRegister. php file include_once. modelusermodel. phpuserModel. php file include_once m...

I wrote a small exercise. the directory structure is as follows:

/View/user/userRegister. php send
Post request to/service/user/userRegister. php
UserRegister. php file include_once
/Model/user/userModel. php
UserModel. php file include_once
/Model/db. php
The specific code contained is
Include_once '.../model/user/userModel. php' in userRegister. php'
-- "Include_once 'in userModel. php'.../db. php'
In eclipse, you can switch by pressing ctrl, but this error is still reported.

Reply content:

I wrote a small exercise. the directory structure is as follows:

/View/user/userRegister. php send
Post request to/service/user/userRegister. php
UserRegister. php file include_once
/Model/user/userModel. php
UserModel. php file include_once
/Model/db. php
The specific code contained is
Include_once '.../model/user/userModel. php' in userRegister. php'
-- "Include_once 'in userModel. php'.../db. php'
In eclipse, you can switch by pressing ctrl, but this error is still reported.

It looks messy. In fact, you can use index in the entry file. in php, define an app_dir variable that represents the root directory (for example, D: \ www \ Xproject). you can splice the app_dir variable every time you include the file. So as not to be so messy.

You can use magic variables to obtain app_dir.DIRTo obtain, of course, whether to intercept, and so on. you can just get the project root directory.

If you have said so much, you have not set the point. use absolute path. Thank you @ libraco.

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.