Open x12311231 opened 7 years ago
已修复
还是抛出一个问题 [1] ErrorException in 16f8c6af2aeb74e99e4e6a878e7428db.php line 132
/*存在子类,则获取子类下的文章*/
if($cid){
$condition['cid'] = $cid;
$children_ids = think\Db::name('category')->field('id')->where('pid',$condition['cid'])->select();
$children_ids = array_column($children_ids,'id'); /***## 出错在这一行***/
}
$list = think\Db::name('article')->where($condition);
if(isset($children_ids) && $children_ids){
$list = $list->whereor('cid','in',$children_ids);
}
if("" != ''){
$list=$list->field("");
}
分析原因是PHP版本低于5.5的原因。nangge大是否应该做下兼容啊。 http://www.thinkphp.cn/code/335.html
已修复
为什么是js 分类, 而不是放到php 分类里面呢
文件位置: application\common\taglib\Tag.php 问题: 条件:where status = 0 and cid = 13 or cid in (2,3,4)(当分类为子类时无法隐藏删除) 应改为:where status = 0 and cid = 13 or cid in (2,3,4) and status = 0;(不知如何用tp5连续操作表达) 所以改为一级分类不能添加文章,二级才能添加文章,也有利于站点结构 修改为: ` /**
获取文章列表 / public function tagArticle($tag, $content) { $cid = isset($tag['cid']) ? $tag['cid'] : 0; $order = isset($tag['orderby']) ? $tag['orderby'] : ''; $limit = isset($tag['limit']) ? $tag['limit'] : 0; $pagesize = isset($tag['pagesize']) ? $tag['pagesize'] : 0; $field = isset($tag['field']) ? $tag['field'] : ''; $empty = isset($tag['empty']) ? $tag['empty'] : ''; $module = request()->module(); /$children_ids = Db::name('category')->where('pid',$cid)->field('id')->select(); print_r(array_column($children_ids,'id'));die;*/ $parse = <<<EOF <?php \$condition['status'] = 0;
EOF;
} `