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

WBOY
Release: 2023-03-02 10:38:01
Original
881 people have browsed it

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!