我在函数中有一个select查询,它在sql命令提示符下执行,显示所有结果。
但在 Postman 的回应中, UserInfo
仅显示1条记录作为响应。
protected function getUserSession(){
$data = $this->params;
$sqlquery = "SELECT `Uid` as UID,`CreatedDate"
. "` as CreatedDate,`Action_key` as ActionKey FROM `UsersOptStatus` ORDER BY Uid DESC LIMIT 10";
$userInfoArray = array();
$userInfoArray = $this->getUsersOptStatusTable()->customquery($sqlquery);
print_r($userInfoArray);
//$uid = $this->getUsersNewTable()->uidFromApiKey($data['UserId']);
return array("errstr"=>"Fetching success.","success"=>1,"data"=>array('UserInfo'=>$userInfoArray));
}
public function customquery($sql) {
$data = $this->tableGateway->getAdapter()->driver->getConnection()->execute($sql);
return $data;
}
选择查询结果:
Postman 的实际结果
在raw选项卡中,所有结果都是获取的
在“漂亮”选项卡中,它显示 Bad String
2条答案
按热度按时间xn1cxnb41#
好的,我找到答案了。
让循环得到结果集。
o4tp2gmn2#
我建议你: