public function initToken($code) { $o = tbauth::getInstance(TAOBAO_LOGIN_APPSECRET, TAOBAO_LOGIN_APPKEY, TAOBAO_LOGIN_CALLBACK); $resp = $o->getToken($code); if ($resp !== null) { $_SESSION['taobao']["access_token"] = $resp['access_token']; $_SESSION['taobao']["expiry"] = $resp['expires_in']; return $_SESSION['taobao']["access_token"]; } return null; }
public static function getInstance($appsecret, $appkey, $callback) { if (self::$_instance === null) { self::$_instance = new self($appsecret, $appkey, $callback); } return self::$_instance; }