Home  >  Article  >  Backend Development  >  How to let the framework load a custom namespace in yii2.0basic?

How to let the framework load a custom namespace in yii2.0basic?

WBOY
WBOYOriginal
2016-12-01 01:27:24908browse

Hello everyone! I added a custom namespace to yii2.0basic such as: commonservice. There is a class Test.php in this folder, which is referenced in TestController.php of controllers. I found that after running, it always prompts that it cannot be found. It should The custom namespace has not been loaded by the framework, so I don't know it. So how to load the custom namespace in basic? In advanced, the alias should be set in commonconfigbootstrap.php. How to set the alias in basic? Thanks!

Reply content:

Hello everyone! I added a custom namespace to yii2.0basic such as: commonservice. There is a class Test.php in this folder, which is referenced in TestController.php of controllers. I found that after running, it always prompts that it cannot be found. It should The custom namespace has not been loaded by the framework, so I don't know it. So how to load the custom namespace in basic? In advanced, the alias should be set in commonconfigbootstrap.php. How to set the alias in basic? Thanks!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn