The N method of ThinkPHP is a counter method. This article mainly introduces the N method of ThinkPHP. For more information, see ThinkPHP.
The N method of ThinkPHP is a counter method used for core queries and cache statistics. But it can be used for other counting purposes of the application. the usage is relatively simple. The Call format is as follows:
N ('Count position' [, 'step value'])
For example, to count the number of queries on the page, you can use
N ('read', 1 );
This indicates that each execution at this position will cause the counter to add 1. before the page ends, we can use
$ Count = N ('read ');
To count the number of queries executed on the current page.
If you want to increase the counter by 5 each time, you can change the step value, for example:
N ('score ', 5 );
Note that the statistical results after the N method page is executed are not included in the next statistics.