Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use count in thinkphp

Shulou Source: shulou.com Published: 2022-06-01 14:40:17 10月03日 Update

In this article, the editor introduces in detail "how to use count in thinkphp", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use count in thinkphp" can help you solve your doubts.

In thinkphp, the count method is a statistical query method used to count the number of data tables or data records, and the result returned is the number of statistical characters, with the syntax "$model-> [where ()->] count ();".

This article operating environment: Windows10 system, ThinkPHP5 version, Dell G3 computer.

What is the use of count in thinkphp

Statistical query method in ThinkPHP

In ThinkPHP, the system provides the following query methods to facilitate the use of statistics in the later stage.

Count () represents the total number of records in the query table

Count method

Syntax:

Model-> [where ()->] count ()

Case: query the total number of records in the department table.

/ / count method public function test () {/ / instantiate the model $model = M ('Dept'); / / count method $result = $model-> count (); / / print dump ($result) } after reading this, the article "how to use count in thinkphp" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself. If you want to know more about related articles, you are welcome to follow the industry information channel.

Tags: Methods queries statistics articles content data systems syntax appropriateness characters examples that is ideas data tables new knowledge more query tables cases models steps Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Technology MySQL Docker Shulou Tech Info