php 获取远程文件类型


        $file_path = 'https://a.apios.ltd/uf/205944b0tyx9pv1ztas0ev.thumb.jpg-ture.jpg';
        // 获取远程文件的 HTTP 头信息
        $headers = get_headers($file_path, true);
        if ($headers === FALSE) {
            die('无法获取远程文件的头信息');
        }
        // 查找 Content-Type 头字段
        $contentType = isset($headers['Content-Type']) ? $headers['Content-Type'] : '未知类型';

推荐阅读:

收藏
文章目录


    -

    mysql用户表root用户被锁定

    评 论