have php got validate class or functions?
I'm searching php validate functions. In my opinion regex is hard.
Has Php got ready function?
i want to validate this variable:
Telephone Numer E-mail adress
Maybe More...
And i want开发者_C百科 to deactive html tags incoming data from textarea.
Take a look at Validate filters, filter_var.
For the HTML tags you can either remove them or escape them
Regular Expressions are going to be the most robust way to validate things like phone numbers and email addresses.
They're not too hard to learn if you have a good resource. And it's an excellent tool to have in your developer toolbox. Check out http://www.regular-expressions.info/tutorial.html. Otherwise, I'm sure you can find some existing validation functions by doing a search on Google or SO.
Take a look at strip_tags()
for removing HTML tags from strings.
Take a look at filter_var
Validating telephone numbers and email addresses is very hard, and complicated but conflicting opinions as to what constitutes a valid phone number (UK only? Some other country only? Multiple countries? What about extensions? Should the number be prefixed with a +
? Are hyphens or other separating characters allowed?) or email address (see one take on this).
PHP has no built ins for this.
精彩评论