客户端验证Javascript或服务器端验证PHP

客户端验证Javascript或服务器端验证PHP

问题描述:

我有一个表单,提交在数据库中输入的数据。是否建议同时执行客户端和服务器端验证?

I have a form which submits data which is entered in the database. Is is recommended to perform both client side and server side validation ?

这里的很多答案都涉及信任,但这并不完全是OP要求的是什么。

A lot of answers here deal with trust but that's not exactly what the OP is asking.


是否[建议]执行
客户端和服务器端验证

Is [it] recommended to perform both client side and server side validation ?

,在现代网络应用程序中,用户期望快速响应,如果您可以做一些简单的数据质量检查前面,做它们。这样做只会让用户的生活更美好。出于同样的原因,出于安全原因,您必须进行服务器端验证。我遵守以下规则...

Yes, in modern web applications users expect fast responses and if you can do some simple data quality checks up front, do them. Doing so can only make the user's life better. On the same token you must do server side validation for security reasons. I live by the following rule...

客户端是否检查可用性并进行服务器端检查以确保数据完整性和安全性。