Example: 1. do not read the database validity verification (whether to fill in the verification, password length verification, mailbox validity verification) 2. verify the validity of the database (repeated user name verification) 3. repeated password verification (should this be the first type ?) 4. other unspecified... * The original segmentfault has... for example:
1. Do not read the database validity verification (whether to fill in the verification, password length verification, mailbox validity verification)
2. verify the validity of the database (repeated user name verification)
3. Duplicate password verification (should this be the first type ?)
4. other unspecified...
/* The original segmentfault hasNewbie Q &Section, so the question is no longer shy */
Reply content:
For example:
1. Do not read the database validity verification (whether to fill in the verification, password length verification, mailbox validity verification)
2. verify the validity of the database (repeated user name verification)
3. Duplicate password verification (should this be the first type ?)
4. other unspecified...
/* The original segmentfault hasNewbie Q &Section, so the question is no longer shy */
Generally, the content to be verified on the front end must also be verified on the backend, because JavaScript verification can be bypassed after the browser disables JavaScript verification.
Front-end verification is to improve the experience and reduce connection requests. For example, what you call password length verification and mailbox validity verification can be verified on the front end, and there is no need to submit it to the backend for verification, putting this part of processing to the client can relieve the pressure on the server (for highly concurrent websites, the effect is obvious ).
So what should we put in the backend for verification? Common problems are related to database operations, such as repeated user name verification and password verification. For better experience, ajax is usually used to initiate requests to the backend, without refreshing the new page for verification (which can also save traffic ). In addition to the possibility of putting database operations on the backend for verification, there are also some other situations that may also be put on the backend for verification. For example, an algorithm is required for checking a field, it is impossible to write the implementation of this algorithm to js.
In general, stick to the principle that all verifications should be put on the front-end for verification as much as possible, and the front-end for verification is verified again.