rename(iconv('utf-8','gbk','../css/你好.css'),iconv('utf-8','gbk','../css/我很好.css'));
2016-12-26
中文乱码用iconv()转换代码,PHP 7.0及更早版本的文件系统函数返回的文件名都是gbk编码的,PHP 7.1开始支持UTF-8文件名和IO流。
2016-11-29
while (($item = readdir($handle)) !== false) {
if ($item == '.' || $item == '..') continue;
$_source = $source . '/' . $item;
$_dest = $dest . '/' . $item;
if (is_file($_source)) copy($_source, $_dest);
if (is_dir($_source)) copydir($_source, $_dest);
}
if ($item == '.' || $item == '..') continue;
$_source = $source . '/' . $item;
$_dest = $dest . '/' . $item;
if (is_file($_source)) copy($_source, $_dest);
if (is_dir($_source)) copydir($_source, $_dest);
}
while (($item = readdir($handle)) !== false) {
if ($item == '.' || $item == '..') continue;
$item = $path . '/' . $item;
if (is_file($item)) $size += filesize($item);
if (is_dir($item)) $size += dirsize($item);
}
if ($item == '.' || $item == '..') continue;
$item = $path . '/' . $item;
if (is_file($item)) $size += filesize($item);
if (is_dir($item)) $size += dirsize($item);
}
2016-11-25