[英]client and php server side validation
I'm starting developing a new application and I'm think about client and server side validation. 我开始开发新的应用程序,并考虑客户端和服务器端验证。 Client side validation is all sorted but obviously I want to make sure everything is still correct once it reaches the server.
客户端验证已全部排序,但是显然我想确保一旦到达服务器,一切仍然正确。
I was thinking about creating classes and using the setters to validate the data before doing anything. 我在考虑创建类并在执行任何操作之前使用setter验证数据。 If there were any errors I would record those in an array inside the class which could be checked before taking any action.
如果有任何错误,我会将这些错误记录在类内部的数组中,可以在执行任何操作之前对其进行检查。
Does this sound like a reasonable approach or am I going down the wrong path? 这听起来像是一种合理的方法,还是我走错了路?
Thanks, Andy 谢谢,安迪
Google上有很多有关如何在服务器端验证数据的教程, 这就是其中之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.