<?php
/**
 * 文件工具类
 */

namespace Common\Util;
class FileUtil extends CommonUtil
{
    /**
     * @param $file
     * @return bool
     */
    public static function check_file_exists($file)
    {
        if (stripos($file, 'http') === 0) {// 远程文件
            $header = get_headers($file, true);
            return isset($header[0]) && (strpos($header[0], '200') || strpos($header[0], '304'));
        } else {// 本地文件
            return file_exists($file);
        }
    }

}

相关文章:

  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
  • 2022-01-28
  • 2021-10-12
猜你喜欢
  • 2022-12-23
  • 2022-02-20
  • 2021-10-29
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案