Costruzione API Discuz
Scarica il file API:
Turisti, se volete vedere il contenuto nascosto di questo post, vi prego Risposta
Metti la cartella appapi nella directory DZ per eseguirlahttp://xxxx.com/appapi/install.php
Quando il browser dice "Installato con successo", puoi eseguire le seguenti operazioni
Struttura della directory
<appapi> ├connect.php ├image.php ├inc.php ├index.php//Home Controller index.php?mod=index&XXX ├install.php//installazione, si consiglia di eliminarlo dopo il completamento dell'installazione. ├login.php // Accedi per ottenere il token, che include anche le informazioni dell'utente dopo l'accesso. ├register.php ├<config> │ ├config.php │ ├config_extra.php │ ├permission_config.php │ └smiley_map.php ├<lib> │ ├class_member.php │ ├json.class.php │ ├lib_app_helper_attach.php │ ├lib_appversion.php │ ├lib_bfd_app.php │ ├lib_bfd_perm.php │ └lib_bfd_user.php ├<qqconnect> │ ├connect.class.php │ ├index.htm │ ├qqshow.inc.php │ ├spacecp.inc.php │ ├<connect> │ │ ├connect_check.php │ │ ├connect_config.php │ │ ├connect_feed.php │ │ ├connect_login.php │ │ ├connect_user.php │ │ └index.htm │ ├<table> │ │ ├index.htm │ │ ├table_common_connect_guest.php │ │ ├table_common_member_connect.php │ │ ├table_connect_disktask.php │ │ ├table_connect_feedlog.php │ │ ├table_connect_memberbindlog.php │ │ ├table_connect_postfeedlog.php │ │ └table_connect_tthreadlog.php │ ├<template> │ │ ├extend_common.css │ │ ├extend_module.css │ │ ├index.htm │ │ ├module.htm │ │ ├qqshow.htm │ │ └spacecp.htm ├<source> │ ├bfd_app_favorite_action.php │ ├bfd_app_favorite_list.php │ ├bfd_app_forum_list.php │ ├bfd_app_forum_misc.php │ ├bfd_app_group_action.php │ ├bfd_app_group_all.php │ ├bfd_app_group_index.php │ ├bfd_app_group_info.php │ ├bfd_app_group_my.php │ ├bfd_app_group_thread.php │ ├bfd_app_group_thread2.php │ ├bfd_app_index.php │ ├bfd_app_index_threads.php │ ├bfd_app_index2.php │ ├bfd_app_post_newthread.php │ ├bfd_app_post_reply.php │ ├bfd_app_search.php │ ├bfd_app_send_pm.php │ ├bfd_app_sign.php │ ├bfd_app_space_notice.php │ ├bfd_app_space_pm.php │ ├bfd_app_space_thread.php │ ├bfd_app_thread_activity.php │ ├bfd_app_tip.php │ ├bfd_app_tip_message.php │ ├bfd_app_topicadmin.php │ ├bfd_app_user_action.php │ ├bfd_app_user_avatar.php │ ├bfd_app_user_detail.php │ ├bfd_app_user_follow.php │ ├bfd_app_user_friend.php │ ├bfd_app_user_space.php │ ├bfd_app_userinfo.php │ ├<include> │ │ ├thread_activity.php │ │ ├thread_activity_form.htm │ │ ├thread_poll.php │ │ └viewthread_activity.htm │ ├<search> │ │ ├index.htm │ │ ├search_album.php │ │ ├search_blog.php │ │ ├search_collection.php │ │ ├search_forum.php │ │ ├search_group.php │ │ ├search_my.php │ │ ├search_portal.php │ │ └search_user.php │ ├<topicadmin> │ │ ├topicadmin_delpost.php │ │ └topicadmin_moderate.php ├<template> │ ├footer.htm │ ├header.htm │ ├register.htm │ ├seccheck.htm │ ├<style> │ │ ├common.js │ │ ├jquery-1.8.3.min.js │ │ ├style.css │ │ ├<images> │ │ │ ├login.png │ │ │ └login_on.png ├<unit_test> │ ├test.php │ ├test_config.php │ ├test_function.php │ ├test_inc.php │ └test_send_pm.php
Accedi a Token per ottenerlo
Vogliamo ottenere i dati dell'utente e pubblicare un token per memorizzare un login Cookis Login.php utente Apri Login e possiamo vederlo.
Dobbiamo solo inserire i valori di queste due variabili in POST per accedere.
JSON restituisce valore
Restituisce l'avatar base dell'utente, il nome utente, l'indirizzo email e altre informazioni dell'utente, che possono essere modificate nel file sorgente.
{"errornum":"E00000","errormsg":"\u7528\u6237\u767b\u5f55\u6210\u529f","data":{"uid":"1","avatar":"http:///\/127.0.0.1\/dz\/uc_server\/avatar.php?uid=1&size=middle"," Nome utente":"admin","email":"admin@admin.com","password":"a5ecf2332da38601e6fadd79ee69840f","groupid":"1","extcredits1":"0","extcredits2":"2","follower":"0","following" :"0","gender":"\u4fdd\u5bc6","department":"","constellation":"","medals":[],"bloodgroup":"sightml":"","token": "65faMdFDBMcsPpO3zghoLJIAsBLOFRNbOU61rjVZsCYtN8zAlOoW4hbRUno4fufoxtbtwuJX1L+iur97LFjWVnkBow17h\/vAnGk","token_expire":"1493655981"}} La cosa principale di cui abbiamo bisogno è ottenere il token unico dell'utente.
"token":"65faMdFDBMcsPpO3zghoLJIAsBLOFRNbOU61rjVZsCYtN8zAlOoW4hbRUno4fufoxtbtwuJX1L+iur97LFjWVnkBow17h\/vAnGk" Poi lo scriviamo in Cookis, e possiamo fare altre operazioni nella index.php?mod. Stiamo parlando approssimativamente dell'uso qui, dell'uso specifico di alcuni documenti API, il controller corrispondente alla LIB è stato spiegato, e ci sono punti in cui non capisco, per favore lasciatemi un messaggio.
|