Home > Backend Development > PHP Tutorial > How to detect whether url exists in php, php detects whether url exists_PHP tutorial

How to detect whether url exists in php, php detects whether url exists_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:57:09
Original
942 people have browsed it

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.

www.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...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template