A non well formed numeric value encountered
来源:5-4 利用tp5分页机制处理列表页
许安强
2017-05-03
请问该如何解决问题
public function index()
{
$parentId = input('.get.parent_id',0,'intval');
$categorys = $this->obj->getFirstCategorys($parentId);
return $this -> fetch('',[
'categorys' => $categorys,
]);
}
public function getFirstCategorys($parentId = 0){
$data = [
'status' => ['neq',-1], //表示不等于-1
'parent_id' => $parentId,
];
$order = [
'id' => 'desc',
];
//$result = $this->where($data)->order($order)->select();
$result = $this->where($data)->order($order)->paginate(2);//每页显示的条数
echo $this->getLastSql(); //打印sql语句
return $result;
}

写回答
5回答
-
singwa
2017-05-03
您的tp是哪个版本的?
00 -
singwa
2017-05-03
input('.get.parent_id',0,'intval'); 修改为 input('get.parent_id',0,'intval');
00 -
singwa
2017-05-03
Input 方法里面你写错啦
00 -
许安强
提问者
2017-05-03
和您的版本是一样的
00 -
许安强
提问者
2017-05-03
是有问题,谢谢您解决我那个不能获取到$parentId的问题,这块好像是参数类型的问题
022017-10-24
相似问题