Question 2. How can I tell which rule a string conforms to in a data table?
Public platform Development,
Start with a timetable, that is, the schedule is handled by Function1 (which is, of course, set in the database, and now, for example, fixed),
Starting with 2015, ^2015 is handled by function2,
Completely equals 报名
, that is ^ registration $ is processed by Function3.
In the data table is
Rule |
function |
priority (Precedence) |
^ Timetable |
Function1 |
1 |
^2015 |
Function2 |
1 |
^ Registration $ |
Function3 |
1 |
...... |
...... |
...... |
How do I get the value to determine which one it corresponds to (assuming that the priority issue is not considered)?
Question 1. How to determine a value in a range of data tables
Membership form,
Id,username,password,truename,avatar,score,balance,add_time,regip
Rating table,
0-100 is level1.
101-500 Level2
501-1500 LEVEL3
Now get the user's points, say 299. How to tell if it is Level2?
The loop is indeed possible. But the efficiency is not high. And this is set by the user is not fixed.
Reply content:
Question 2. How can I tell which rule a string conforms to in a data table?
Public platform Development,
Start with a timetable, that is, the schedule is handled by Function1 (which is, of course, set in the database, and now, for example, fixed),
Starting with 2015, ^2015 is handled by function2,
Completely equals 报名
, that is ^ registration $ is processed by Function3.
In the data table is
Rule |
function |
priority (Precedence) |
^ Timetable |
Function1 |
1 |
^2015 |
Function2 |
1 |
^ Registration $ |
Function3 |
1 |
...... |
...... |
...... |
How do I get the value to determine which one it corresponds to (assuming that the priority issue is not considered)?
Question 1. How to determine a value in a range of data tables
Membership form,
Id,username,password,truename,avatar,score,balance,add_time,regip
Rating table,
0-100 is level1.
101-500 Level2
501-1500 LEVEL3
Now get the user's points, say 299. How to tell if it is Level2?
The loop is indeed possible. But the efficiency is not high. And this is set by the user is not fixed.
You two questions, can you think for a moment, for example, the question
0-100 is level1.
101-500 Level2
501-1500 LEVEL3
You record the user's points field in the membership table, 299 is a value, and then you to these levels, do a configuration file, this can be you define or give the user to define the generated configuration file, according to a certain value is broken, which level, do not need additional judgment
Q1 can be a constant array or configure a config file in the background, each time you fetch the information, go to the array to fetch the level.