Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Lithium 中,在获取给定模型的所有行之后,如下所示:
$users = Users::all();
我怎么知道返回了多少行?我正在使用 MySQL 连接器。
谢谢!
如果你只想要计数
$usersCount = Users::count();
如果你想要你的收藏数量
$users = Users::all(); $usersCount = count($users->data())
我想你也可以
$usersCount = $users->count();
我知道上述两种方法将返回相同的结果。 第二种方法是在他调用 Model::find() 而不是 Model::all() 的情况下。