门面
$privacy=ProfilePrivacy::get_by_contact($id);
$access=json_decode($privacy['access_level'],'true');
var_dump($privacy);
辅助
public function get_by_contact($id)
{
$result=$this->_model->get_by_contact($id);
}
模型
public function get_by_contact($id)
{
$sql=" SELECT privacy_access.user_id,privacy_access.access_level,privacy_access.status,privacy_access.created_at
FROM privacy_access
JOIN contacts ON privacy_access.user_id= contacts.id WHERE privacy_access.user_id=?";
$privacy = DB::select($sql, [$id]);
return $privacy;
}
我正在使用var dump来获取$ privacy的响应但是确定空值