Problems encountered in the project:
need:
The laypage component of layui is used to perform paging operations. Friends who are familiar with layui know that laypage needs to give it a total number of items from the server.
But there is a problem when making an ajax request, I define it like this
However, when calling, the value cannot be returned directly, so there is only one way of thinking here.
Query the data in the controller, and then call it in the template
For example this:
1 Template file: templetes\default template path\settle\index.tpl.php
2 The corresponding value controller method: settle.php
Model method called in controller: modules\withdraw\WithdrawModule.php
In this operation, instantiate the model, call the method getCount() defined in the model to query the data, and then assign it to the data['result_count'] variable
3 Then assign it to the view controller settleView.php of the same name, and transfer the data to temple\default template path\settle\index.tpl.php
4 In this way, we can directly obtain the corresponding data in the template file
In this way, the process of sending data from the controller and receiving data from the template file is completed.
Effect: