thinkphp框架where查询方式
publicfunctionuserdata(){$companydata=Company::get(['id'=>$this->loginstaff->cid]);$m...
public function userdata() { $companydata = Company::get(['id' => $this->loginstaff->cid]); $managecid=json_decode($this->loginstaff->managecid, true); $manage=Company::where('id','in', implode(',', $managecid))->find(); $this->assign('manage',$manage); return $this->fetch(); }报错:见图请问是我写法有问题么?
展开
1个回答
展开全部
这说的很明显,参数传参不对。implode();不能当参数传过去,你可以提出来
追问
请问应该怎么写呢?
追答
就是把implode()里面包括的,把他们赋值给一个变量,然后把变量作为参数传进去
public function userdata() {
$companydata = Company::get(['id' => $this->loginstaff->cid]);
$managecid=json_decode($this->loginstaff->managecid, true);
$a = implode(',', $managecid);
$manage=Company::where('id','in',$a)->find();
$this->assign('manage',$manage);
return $this->fetch(); }
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询