Home  >  Article  >  Backend Development  >  php文件服务实现虚拟挂载其他目录示例_PHP

php文件服务实现虚拟挂载其他目录示例_PHP

WBOY
WBOYOriginal
2016-06-01 11:54:451016browse

php文件服务实现虚拟挂载其他目录

复制代码 代码如下:
function base64url_encode($data) {
  return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
  return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
function array_verify($var)
  {
   return isset($var)&&is_array($var) && count($var)>0;
  }
  function format_file_size($var)
  {
   if($var   if($var   if($var   return ($var/1073741824.0).' G';
  }

  $dir="F:";//不以/结尾
  $path="";

 if(array_verify($_GET)&&isset($_GET["path"]))
 {
  $path=base64url_decode($_GET["path"]);
  preg_match("#^[^/].*$|^.*\.$|^\..*$|\./\.|/\.|\./#",$path,$temp);
    if(array_verify($temp))
   {
    echo
      '
              


              
               ';
           echo "璀
Statement:
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