thinkphp Development Framework Function Detailed: N method

Source: Internet
Author: User
Keywords Developing frameworks Functions n methods thinkphp
Tags aliyun cache counter developing developing frameworks development development framework example

The N method belongs to the counter method and is used to count and statistic the core query, cache statistics. But in fact it can be used for other counting purposes, the usage is simpler, calling the format:
N (' Count position ' [, ' step value '])
For example, to count the number of queries in a page, you can use

N (' read ', 1);

Indicates that each execution to this location will cause the counter to add 1, before the end of the page, we can use the

$count &http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp;= N" (' read ');

To count the number of queries executed by the current page.
If you want the counter to increase by 5 each time, you can change the step value, for example:

N (' Score ', 5);

It should be noted that the results of the N method page after execution are not brought into the next statistic.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.