Application examples
Statistics on the number of orders
Solution
Use "aggregation query". Reference documentation
Backend code
Use model.
1. Query statement
$recordNum = \app\index\Model\Reservation::where('username','=',session('username'))->count();2. Pay the query result to the front desk
$this->assign([ 'recordNum'=>$recordNum, ]);Front-end code
ResultA total of {$recordNum}
##Related recommendations:
The latest 10 thinkphp video tutorials