之前一直用overtrue / socialite这个轮子做微信/QQ/钉钉等社交登录,升级到tp6.x后发现redirect后,session/cookie莫名丢失
为了赶进度,发现这个也很不错:thinkphp-social,但callback地址无法额外传参,改进了一下:
thinkphp-social回调地址callback额外传参方法:
在liliuwei\social\Oauth::getRequestCodeURL()的getRequestCodeURL里加个数组参数,如:getRequestCodeURL($paramArr = null)
$this->config();下面增加:
if(is_array($paramArr)) $this->Callback .='&'.http_build_query($paramArr); //跳转到授权页面 $this->redirect($sns->getRequestCodeURL(['action'=>'bind']));
2020年10月06日,这个地方:liliuwei\social\sdk\Weixin::getRequestCodeURL()也要和上面的一致,加上参数
上一篇: 《建站管家》二次开发文档