Home > Backend Development > PHP Tutorial > yii2基础模板中没有common公共的文件夹,那自己写的方法要放哪

yii2基础模板中没有common公共的文件夹,那自己写的方法要放哪

WBOY
Release: 2016-06-06 20:19:29
Original
2270 people have browsed it

基础模板中没有common这文件夹,该怎么配置?还有怎么使用common里的方法?

回复内容:

基础模板中没有common这文件夹,该怎么配置?还有怎么使用common里的方法?

直接建一个 common 文件夹就好.

例如建立一个 common/Util.php:

<code>namespace app\common;

class Util
{

}</code>
Copy after login

使用的时候就只直接可以用了:

<code>use app\common\Util;

Util::somefuc();</code>
Copy after login
Related labels:
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