How to detect whether url exists in php, how to detect whether url exists in php
The example in this article describes how to detect whether url exists in php. Share it with everyone for your reference. The details are as follows:
Copy code The code is as follows: function url_exists($url) {
$hdrs = @get_headers($url);
Return is_array($hdrs) ? preg_match('/^HTTP\/\d \.\d \s 2\d\d\s .*$/',$hdrs[0]) : false;
}
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/984011.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/984011.htmlTechArticleHow to detect whether url exists in php, php detects whether url exists. This example describes how to detect whether url exists in php. Share it with everyone for your reference. The details are as follows: Copy the code The code is as follows...