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