I don’t know if there is a more convenient method.
我想大声告诉你2017-06-29 10:09:58
This is a problem of user experience
Front-end verification is to allow illegal data to report errors in time without submitting it to the server and without network requests. This experience is good because it is impossible to load and then request the server every time it is submitted
Server-side verification is for final data security to prevent illegal data entry
扔个三星炸死你2017-06-29 10:09:58
This is not a problem of optimization. It is better not to be lazy when passing parameters. There should be no less verification
習慣沉默2017-06-29 10:09:58
It is definitely safer to verify both the front and back ends.
If you want to be lazy, just don’t verify the front end or do some simple verification. Let the back end verify and return an error message every time. But this is not an optimization.
欧阳克2017-06-29 10:09:58
Let me talk about the conclusion first, there is no way to optimize it.
Front-end verification is mainly for user experience, without requesting the server or requesting the server without refreshing the page.
Server-side verification is to verify the correctness and legality of the data and ensure that the data written to the database meets business requirements.