我用的测试号,tp框架,代码如下:
$options = C('OPTIONS');
$app = new Application($options);
if (!cookie('openid')){
$targetCallBackUrl = $customeUrl = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"].'?action=callBack';
$targetUrl = $customeUrl = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"].'?action=callBack';
if (I('action')=='callBack') {
$user=$app->oauth->user();
$this->userInfo=$user->toArray();
cookie('openid',$this->userInfo['id']);
header('location:'. $targetUrl);
}else{
$app->oauth->scopes(['snsapi_userinfo'])->redirect($targetCallBackUrl)->send();
}
}else{
$userService = $app->user;
$this->openid = cookie('openid');
$this->userInfo = $userService->get($this->openid)->toArray();
}
我测试一下午就报错说接口调用达到上限了,这是怎么回事呢?是不是这个认证过程有问题?