|
@@ -138,12 +138,12 @@ class GameClient {
|
|
|
$response = new ResFriendList();
|
|
|
$response->mergeFromString($binaryData);
|
|
|
if($response->getSuccess()){
|
|
|
- var_dump([
|
|
|
- 'count' => $response->getList()->count(),
|
|
|
- 'first_item' => $response->getList()->offsetGet(0),
|
|
|
- 'is_empty' => $response->getList()->count() === 0,
|
|
|
- 'iterator_data' => iterator_to_array($response->getList())
|
|
|
- ]);
|
|
|
+ echo "count: " . $response->getList()->count() . "\n";
|
|
|
+ $array = [];
|
|
|
+ foreach ($response->getList() as $item) {
|
|
|
+ $array[] = $item->serializeToJsonString(); // 如果元素也是 Protobuf 对象
|
|
|
+ }
|
|
|
+ echo json_encode($array, JSON_PRETTY_PRINT);
|
|
|
echo "\n";
|
|
|
}else{
|
|
|
echo "获取好友列表失败" .$response->getErrMsg()->getErrorMsg();
|