<?php $output = Array (); $a = @$_get[' a ']?
$_get[' A ']: '; $uid = @$_get[' uid ']?
$_get[' uid ': 0;
if (empty ($a)) {$output = array (' Data ' =>null, ' info ' => ' pit Dad! ', ' Code ' =>-201);
Exit (Json_encode ($output)); //GO interface if ($a = = ' get_users ') {//Check user if ($uid = = 0) {$output = array (' Data ' =>null, ' info ' => ' The UID is null!
', ' Code ' =>-401);
Exit (Json_encode ($output));
//Suppose $mysql is the database $mysql = Array (10001 => array (' UID ' =>10001, ' VIP ' =>5, ' nickname ' => ' Shine ' X '), ' Email ' => ' 979137@qq.com ', ' QQ ' =>979137, ' Gold ' =>1500, ' Powerplay ' => array (' 2XP ' =>12, ' Gem ' =>12, ' B Ingo ' =>5, ' Keys ' =>5, ' chest ' =>8, ' gems ' => Array (' Red ' =>13, ' green ' =>3, ' Blue ' =>8, ' yellow ' =>
, ' CTime ' =>1376523234, ' lastlogin ' =>1377123144, ' level ' =>19, ' exp ' =>16758,), 10002 => Array ( ' UID ' =>10002, ' VIP ' =>50, ' nickname ' => ' Elva ', ' email ' => ' elva@ezhi.net ', ' QQ ' =>null, ' Gold ' =>14320, ' Powerplay ' => array (' 2XP ' =>1, ' Gem ' =>120, ' Bingo ' =>51, ' Keys ' =>5, ' chest ' =>8), ' gems ' => Array (' Red ' =>13, ' green ' =>3, ' Blue ' =>8, ' yellow ' =>17), ' CTime ' =>1376523234, ' Lastlogin ' => 1377123144, ' Level ' =>112, ' exp ' =>167588, 10003 => Array (' UID ' => 10003, ' VIP ' => 5, ' nickname ' => ' Lily ', ' email ' => ' Lily@ezhi.net ', ' QQ ' => NULL, ' Gold ' => 1541, ' Powerplay ' => array (' 2XP ' =&G T;2, ' Gem ' =>112, ' Bingo ' =>4, ' Keys ' =>7, ' chest ' =>8 ', ' Gems ' => Array (' Red ' =>13, ' green ' =>3, ' blue '
=>9, ' Yellow ' =>7, ' CTime ' => 1376523234, ' Lastlogin ' => 1377123144, ' Level ' =>, ' exp ' => 1758,
),
);
$UIDARR = Array (10001,10002,10003); if (In_array ($uid, $UIDARR, True)) {$output = array (' Data ' => NULL, ' info ' => ' The user does not exist! ', ' Code ' => ;
-402);
Exit (Json_encode ($output));
//Query Database $userInfo = $mysql [$uid]; Output Data $output = Array (' Data ' => arrAy (' userInfo ' => $userInfo, ' islogin ' => true,//whether the first landing ' unread ' => 4,//unread message number ' Untask ' => 3,//the unfinished Task)
, ' info ' => ' Here's the message which, commonly used in popup window ',//Messages prompt, the client often uses this as the window information.
' Code ' => 200,//success and failure codes, usually positive or negative numbers;
Exit (Json_encode ($output)); ElseIf ($a = = ' Get_games_result ') {//... die (' You are tuning Get_games_result interface! '); ElseIf ($a = = ' Upload_avatars ') {//
... die (' You are tuning Upload_avatars interface! '); }
The above is a small series for everyone to bring PHP API data Interface Writing example (recommended) All the content, I hope to help you, a lot of support cloud Habitat Community ~