: This article mainly introduces static 4 on the 51PHP page. For more information about PHP tutorials, see. All static-local static
Steps:
1. Compile the interface
Connect to databaseRequire_ Once ('. /db. php '); $ connect = Db: getInstance ()-> connect (); $ SQL = 'select * from hit as a join news as B on. news_id = B. id order by. count desc limit 3'; $ result = mysql_query ($ SQL, $ connect); while ($ row = mysql_fetch_assoc ($ result) {$ res [] = $ row ;} // 1 indicates the success code return show (1, 'success', $ res); // you can call the function show ($ code = 0, $ message = 'error ', $ data = array () {$ result = array ('code' => $ code, 'message' => $ message, 'data' => $ data ,); echo json_encode ($ result );}
Plug-in name: JSON-handle
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above introduces 51 PHP page static 4, including require, connection to the database content, hope to be helpful to friends who are interested in PHP tutorials.