YII Path Problems. Why is it that the file cannot be found?

Source: Internet
Author: User
Add files to the directory of the YII project, which is consistent with the basic PHP file loading method. For example, add a function. php file in protected. In the index. php intermediate, direct: require_once (& #039 ;. protectedfunction. php & #039;); but use Yii: app ()-& amp ;... add files to the directory of the YII project, which is consistent with the basic PHP file loading method. For example, add a function. php file in protected. In the middle of index. php, directly:
Require_once ('./protected/function. php ');
However Yii::app()->request->baseUrl./protected/function.php。The file cannot be found. For example:
require_once(Yii::app()->request->baseUrl.'/protected/function.php');
Why is the file not found in the second method?
The error is:
Require_once (/manyouren/2/protected/function. php): failed to open stream: No such file or directory

Reply content:

Add files to the directory of the YII project, which is consistent with the basic PHP file loading method. For example, add a function. php file in protected. In the middle of index. php, directly:
Require_once ('./protected/function. php ');
HoweverYii::app()->request->baseUrl./protected/function.php。The file cannot be found. For example:
require_once(Yii::app()->request->baseUrl.'/protected/function.php');
Why is the file not found in the second method?
The error is:
Require_once (/manyouren/2/protected/function. php): failed to open stream: No such file or directory

Many methods will not be pasted here. For details, refer
Http://zccst.iteye.com/blog/1233367

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.