最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
用PHP判断远程图片(文件)是否存在
时间:2022-06-24 21:28:29 编辑:袖梨 来源:一聚教程网
| 代码如下 | 复制代码 |
|
/* *用PHP判断远程图片(文件)是否存在 *https://www.111cn.net */ function check_remote_file_exists($url) { curl_setopt($curl, CURLOPT_NOBODY, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1); $result = curl_exec($curl); if ($result !== false) { $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); $found = true; |
|
还有一种简单的方法,但效率是低下的。
| 代码如下 | 复制代码 |
| strstr(current(get_headers($url)), "200") | |