WeChat-php + mysql problem. how can I determine which regular expression of a string matches the data table's value? -Php Tutorial

Source: Internet
Author: User
Question2. how can I determine which rule a string conforms to in the data table? Public platform development starts with a course schedule, that is, ^ The course schedule is handled by function1 (of course, this is set in the database, and now it is fixed for example). It starts with 2015, that is, ^ 2015 is processed by function2, complete... question 2. how can I determine which rule a string matches in the data table?

Public platform development,

It starts with a course table, that is, ^ The Course table is processed by function1 (of course, this is set in the database, and now it is fixed for example ),

Starts with 2015, that is, ^ 2015 is processed by function2,

Completely equalRegister, That is, ^ registration $ is handled by function3.

In the data table

Rule Function Priority (priority)
^ Course schedule Function1 1
^ 2015 Function2 1
^ Registration $ Function3 1
...... ...... ......

How can we get the value to determine which one it corresponds to (assuming that the priority issue is not taken into account )?

Question 1. how to determine a value in a range of a data table

Member table,
ID, USERNAME, PASSWORD, TRUENAME, AVATAR, SCORE, BALANCE, ADD_TIME, REGIP

Level table,
0-is level1
101-500 level2
501-1500 level3

Now we have obtained the user's points, for example, 299. how can we determine if it is level2?

The loop is indeed acceptable. However, the efficiency is not high. This is not fixed by the user.

Reply content: Question 2. how can I determine which rule a string matches in the data table?

Public platform development,

It starts with a course table, that is, ^ The Course table is processed by function1 (of course, this is set in the database, and now it is fixed for example ),

Starts with 2015, that is, ^ 2015 is processed by function2,

Completely equalRegister, That is, ^ registration $ is handled by function3.

In the data table

Rule Function Priority (priority)
^ Course schedule Function1 1
^ 2015 Function2 1
^ Registration $ Function3 1
...... ...... ......

How can we get the value to determine which one it corresponds to (assuming that the priority issue is not taken into account )?

Question 1. how to determine a value in a range of a data table

Member table,
ID, USERNAME, PASSWORD, TRUENAME, AVATAR, SCORE, BALANCE, ADD_TIME, REGIP

Level table,
0-is level1
101-500 level2
501-1500 level3

Now we have obtained the user's points, for example, 299. how can we determine if it is level2?

The loop is indeed acceptable. However, the efficiency is not high. This is not fixed by the user.

If you have two questions, can you think differently? for example, Question 1
0-is level1
101-500 level2
501-1500 level3
You record the user's point field in the member table. 299 is a value, and then you make a configuration file for these levels, this can be defined by you or handed to the user to define the generated configuration file, which is the level of the configuration file that meets a certain value and does not require additional judgment.

Q1 can be used to create a constant array or configure a config file in the background. after obtaining the information, you can retrieve the level from the array.

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.