The app may be facing error issues:
1. App back 2. Data load failed 3. App potential issues and more
Error log table for logging of error messages sent over
CREATE TABLE IF not EXISTS ' error_log ' (' ID ' mediumint (9) Not NULL auto_increment COMMENT ' primary key ', ' app_id ' tinyint (4) not NULL COMMENT ' client device ID ', ' did ' varchar (a) NOT NULL COMMENT ' client device information ', ' version_id ' smallint (6) NOT null COMMENT ' version number ', ' Version_mini ' smallint (6) not null COMMENT ' minor version number ', ' error_log ' varchar (255) NOT NULL COMMENT ' error message ', ' create_time ' int (one) Not NULL COMMENT ' Add time ', PRIMARY KEY (' id ')) engine=myisam DEFAULT Charset=utf8 comment= ' app error log table ' auto_increment=2 ;
When the client app encounters an error, it sends over the appropriate error message and then inserts the database, which is simple.
<?php /**************************************** error Log Write class * Learn PHP's little ant * blog http://my.oschina.net/woshixiaomayi/blog*********************** Load the base class for information judgment//code content please refer to http://my.oschina.net/woshixiaomayi/blog/519783require_once ('./ Common.php '); Class error extends common{public function index () {///////////To confirm the information sent by the client first This->check ();//Determine if the error content has $error_log=isset ($_post[' error_log ')? $_post[' Error_log ']: '; if ($error _log) {// With data, the SQL statement is assembled, ready to be inserted into the database $sql= "insert into ' error_log ' (' app_id ', ' did ', ' version_id ', ' Version_mini ', ' error_ Log ', ' Create_time ') VALUES (". $this->param[' app_id '].", ". $this->param[' did ').", ". $this->param[' Version_ Id ']. ",". $this->param[' Version_mini ']. ", '". $_post[' Error_log ']. "',". Time (). ")"; try{$connect =db::getinstance ()->connect ();} catch (exception $e) {//error message returned to App Return response::show (' Mysql not connect ');} Insert a Database$result =mysql_query ($sql, $connect);//Depending on the results of the database execution, the corresponding data is returned if ($result) {return response::show (200, ' ERROR log insert succeeded ');} Else{return response::show (400, ' ERROR log insert failed ');}}}} $obj =new error (); $obj->index (); ?>
App Development interface Note today is over, think of the first time to do a mobile phone interface, it is really simple, wrong to think just the data json back on OK, there are so many learning in it. Thanks to the Singwa teacher's portrait of the teachers, it is very rewarding. The road ahead is still long, continue to refuel ヾ (≧▽≦ *) o
Small Ant Learning App Interface Development (end)--app Error log Interface development