-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
30 lines (23 loc) · 748 Bytes
/
index.php
File metadata and controls
30 lines (23 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
//引入 composer 的自动载加
require __DIR__ . '/vendor/autoload.php';
//用于连接 服务端
$client = new \Pot\Proto\UserClient('127.0.0.1:8088', [
'credentials' => Grpc\ChannelCredentials::createInsecure()
]);
// 实例化 LoginRequest 请求类
$request = new \Pot\Proto\LoginReq();
$request->setMobile("18701588471");
$request->setPassword("123456");
// 调用远程服务
$get = $client->Login($request)->wait();
list($reply, $status) = $get;
// $reflection = new ReflectionClass ($reply);
// $methods = $reflection->getMethods();
// var_dump($methods);die;
$access_token = $reply->getAccessToken();
$expire_in = $reply->getExpireIn();
var_dump([
'access_token' => $access_token,
'expire_in' => $expire_in
]);