Home >Backend Development >PHP Tutorial >PHP third-party login QQ login video tutorial
Course playback address: http://www.php.cn/course/401.html
The teacher’s teaching style:
The teacher’s lectures are vivid, witty, witty, and touching. A vivid metaphor is like the finishing touch, opening the door to wisdom for students; a well-placed humor brings a knowing smile to students, like drinking a glass of mellow wine, giving people aftertaste and nostalgia; a philosopher's aphorisms, cultural references Proverbs are interspersed from time to time in the narration, giving people thinking and warning.
The more difficult point in this video is the API call example:
1. SDK API call instructions
There is no UI except for the logout and getting application friends API In addition to interaction, after calling the API provided by the following SDK, the corresponding interface will pop up to complete subsequent operations.
1.1 Login/verify login state
Initiate login/verify login state by calling the login function of Tencent class.
This API has two functions:
(1) If the developer does not call the setOpenId and setAccessToken API of the mTencent instance, the API performs normal login operations;
(2) If the developer calls mTencent first If the instance's setOpenId and setAccessToken API are used, the API will perform the operation of verifying the login status. If the login status is valid, success will be returned to the application. If the login status is invalid, the login process will be automatically entered and the latest login status data will be returned to the application.
It is recommended that developers call this API once every time the application is started (call setOpenId, setAccessToken first) to ensure that the user is logged in every time the application is opened.
The sample code for calling the login API is as follows:
private void doLogin() { IUiListener listener = new BaseUiListener() { @Override protected void doComplete(JSONObject values) { updateLoginButton(); } }; mTencent.login(this, SCOPE, listener); }
The above is the detailed content of PHP third-party login QQ login video tutorial. For more information, please follow other related articles on the PHP Chinese website!