用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1076|回复: 0
收起左侧

[HELP] 求助啊!!关于按文件大小排列

[复制链接]
发表于 2015-7-16 18:28:32 | 显示全部楼层 |阅读模式
本帖最后由 agplofree 于 2015-7-16 18:30 编辑
PHP复制代码
public static function cmp_func($a, $b) {                if ($a['is_dir'] && !$b['is_dir']) {
return -1;
} else if (!$a['is_dir'] && $b['is_dir']) {
return 1;
} else {
if ($this->order == 'size') {
if ($a['filesize'] > $b['filesize']) {
return 1;
} else if ($a['filesize'] < $b['filesize']) {
return -1;
} else {
return 0;
}
} else if ($this->order == 'type') {
return strcmp($a['filetype'], $b['filetype']);
} else {
return strcmp($a['filename'], $b['filename']);
}
}
}
复制代码


应该是这一句 if ($this->order == 'size') { 用法错误,但是不知道错在哪。新人自学没多久,求轻喷


本版积分规则