Home  >  Article  >  Backend Development  >  YII2-数据库查询操作

YII2-数据库查询操作

WBOY
WBOYOriginal
2016-06-06 20:16:471507browse

YII2中有没有像TP方法中的 M 函数那样,不需要在models文件里创建该表的模型类也能进行对数据库中的表进行操作

回复内容:

YII2中有没有像TP方法中的 M 函数那样,不需要在models文件里创建该表的模型类也能进行对数据库中的表进行操作

<code>use yii\db\Query;
$users = (new Query())->from('user')->all();</code>

YII2 我没看到提供专业的M函数,具体YII操作数据库方法可以看看下面网页:
http://www.cnblogs.com/rhythmK/p/5135476.html

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