What are the steps to learn how to do the file & quot; header (& #39; Content-type: applicationjson; charsetutf-8 & #39;); require & #39; conn. php & #39; read data $ SQL _noticemysql_query (& #39; SELECTid, marker, 4 & #39;); $ data [] mysql_fetch_array ($ SQL _notice, MYSQL_AS app interface php data
What are the files involved in the steps?
Header ('content-type: application/json; charset = utf-8 '); require 'Conn. php '; // Read data $ SQL _notice = mysql_query ('select id, user_name FROM yxd_user limit'); // $ data [] = mysql_fetch_array ($ SQL _notice, MYSQL_ASSOC ); // The first row // Print the array data of all rows while ($ data [] = mysql_fetch_array ($ SQL _notice, MYSQL_ASSOC) {$ data;} var_dump ($ data); echo"
";
Class Response {/*** encapsulate the communication method in json format * @ param integer $ code Status code * @ param string $ message prompt message * @ param array $ data */public static function json ($ code, $ message = '', $ data = array () {if (! Is_numeric ($ code) |! Is_array ($ data) {return '';} $ result = array ('code' => $ code, 'message' => $ message, 'data' => $ data) echo json_encode ($ result );}}
I have written the two but I don't know how to do it.