I am trying to find out when a web address in submitted to my database, but this code does not seem to be working... any ideas on why it is not working?
if(!stripos($myString, ".com") || !stripos($myString, "http://"))
I am still able to submit a comment containing a web address
If you're using PHP 5.2 or later, you're better off using filter_var, like so:
if(filter_var($myString, FILTER_VALIDATE_URL))
More information on filter_var here .
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.