If (preg_match ('/\ D/', $ page)

Source: Internet
Author: User
If (preg_match ('/\ D/', $ page) what does it mean if (preg_match ('/\ D/', $ page) {$ this-& gt; page = 1 ;}else {$ this-& gt; page = $ page ;}, paging? If the page number ($ page) contains a non-number, if (preg_match ('/\ D/', $ page), what does it mean?
If (preg_match ('/\ D/', $ page ))

{$ This-> page = 1;
}
Else {
$ This-> page = $ page;
}


------ Solution --------------------
Paging?
If a non-number exists in the page number ($ page), set the page number to 1.

------ Solution --------------------
Regular expression, matching $ page whether it contains digits
If no number exists, $ this-> page = 1;
------ Solution --------------------
If condition preg_match ('/\ D/', $ page) is a regular match
Match non-numeric content on $ page. \ d is a number \ D is not a number
------ Solution --------------------
Regular Expression Matching: matches non-numeric content on $ page. \ d is a number. \ w represents uppercase and lowercase letters, numbers, and underscores, \ W indicates the opposite of \ w, and so on!

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.