简体   繁体   中英

PHP filter_var: FILTER_VALIDATE_URL include more cases

It only validates urls that are of the format: http://www.example.com

How do I also validate partial urls, such as: www.example.com, example.com, or blah/example.php, etc...

(I need to do this to filter out posts/comments that only contain a url)

I believe HTML has some new input types that do this for you, I dont know if it does it the way you want but here have a look! http://www.w3schools.com/html5/html5_form_input_types.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM