PHP检测远端文件是否存在-PHP源码
php代码函数描述及例子
//测试代码 $str_url = 'http://127.0.0.2/viewarticle.php?id=119617'; $exits = remote_file_exists($str_url); echo $exists ? "Exists" : "Not exists"; ?>
方法一(需要开启allow_url_fopen):
方法二(需要服务器支持Curl组件):
函数描述及例子
//测试代码 $str_url = 'http://127.0.0.2/viewarticle.php?id=119617'; $exits = remote_file_exists($str_url); echo $exists ? "Exists" : "Not exists"; ?>
方法一(需要开启allow_url_fopen):
方法二(需要服务器支持Curl组件):
PHP之友评论