Counters Component Reference (iii)-increment method

Source: Internet
Author: User
Reference Increment
The Increment method adds the value of the counter by 1, based on the name of the counter, and returns a new value for the counter. If the counter does not exist, this method creates the counter and sets its value to 1.

Grammar
Counters.Increment (CounterName)

Parameters
CounterName
A string that contains the counter value.
Example
Use the <% counters.increment (CounterName)%> to increase the value of the counter. Use the <%= counters.increment (CounterName)%> to increase and display counter values.

In order to get the value of the counter, you can use Counters.Get. To set the value of the counter to a special value, use Counters.Set.

The following code implements the online page access counter.

<p>there have been <%= counters.increment ("hits")%> visits to this Web page.
</P>

In the following example, each time a client makes a page request to the server, it uses Counters.Increment to add the counter value by 1.



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.