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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-03-02 10:38:01
Original
965 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
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template