- 论坛徽章:
- 0
|
只有自己写函数处理了- /**
- * 函数 cpathinfo
- * 功能 双字节可靠的路径信息
- **/
- if(! function_exists('cpathinfo')):
- function cpathinfo($path, $type=0) {
- $path = str_replace('\\', '/', $path);
- if(substr($path, -1) == '/') {
- $path = substr($path, 0, -1);
- }
- $t = split('/', $path);
- $r['basename'] = array_pop($t);
- $r['dirname'] = join('/', $t);
- $r['extension'] = substr(strrchr($r['basename'], '.'), 1);
- switch($type) {
- case PATHINFO_EXTENSION:
- return $r['extension'];
- case PATHINFO_BASENAME:
- return $r['basename'];
- case PATHINFO_DIRNAME:
- return $r['dirname'];
- }
- return $r;
- }
- endif;
- /**
- * 函数 cbasename
- * 功能 双字节可靠的basename
- **/
- if(! function_exists('cbasename')):
- function cbasename($path) {
- return cpathinfo($path, PATHINFO_BASENAME);
- }
- endif;
- /**
- * 函数 cdirname
- * 功能 双字节可靠的dirname
- **/
- if(! function_exists('cdirname')):
- function cdirname($path) {
- return cpathinfo($path, PATHINFO_DIRNAME);
- }
- endif;
复制代码 |
|