Use and definition of PHP abstract classes & lt ;? Phpshortactclassa {public $ name; functionfun () {echo $ this-& gt; name;} abstractfunctioncc ($ n, $ nn = 3);} classBextendsA {functioncc ($ m, $
Use and definition of PHP abstract classesName;} abstract function cc ($ n, $ nn = 3);} class B extends A {function cc ($ m, $ mm = 7) {echo "aaa" ;}}$ B = new B ;?> PHP object-oriented interface definitionTwo examples: abstract class example:Host = $ h; $ this-> user = $ u; $ this-> passwd = $ p; $ this-> dbname = $ d; $ this-> charset = $ c; $ this-> conn ();} function conn () {@ mysql_connect ($ this-> host, $ this-> user, $ this-> passwd) or die ("mysql connection failed"); @ mysql_select_db ($ this-> dbname) or die ("database connection failed "); $ this-> q ("set names '". $ this-> charset. "'");} function q ($ n) {return mysql_query ($ n);} function id () {return mysql_insert_id ();} function f ($ n, $ st = 1) {switch ($ st) {c Ase 1: $ rs = mysql_fetch_array ($ n); break; case 2: $ rs = mysql_fetch_row ($ n); break;} return $ rs ;} // ========================================// *** NOTE: into database insertion method * parameter: $ tb table name, $ val indicates the inserted value, $ st debugging method, 1 debugging 0 not debugging * return: int */abstract function into ($ tb, $ val, $ st = 0);/*** NOTE: sel_once query * parameter: $ tb table name, $ wh condition default 1, $ ar field, $ ty query type, default subscript and key name, $ st debugging status, default value: 0, 1 debugging 0 not debugging * return: array [one-dimensional array] */abstract function sel_once ($ tb, $ wh = 1, $ ar = "*", $ ty = 1, $ st = 0);/*** NOTE: sel_al L query * parameter: $ tb table name, $ wh condition default 1, $ ar field, $ ty query type, Default subscript and key name, $ st debugging status, the default value is 0, 1. debug 0. do not debug *. return: array [two-dimensional array] */abstract function sel_all ($ tb, $ wh = 1, $ ar = "*", $ ty = 1, $ st = 0);/*** description: update database method * parameter: $ tb table name, $ val update content $ wh condition [1 limit 1], $ st debug mode default 0, 1 debug 0 not debug * return: int */abstract function update ($ tb, $ val, $ wh = "1 limit 1", $ st = 0);/*** description: del database deletion method * parameter: $ tb table name, $ wh condition [1 limit 1], $ st debugging mode default 0, 1 debugging 0 not debugging * return: int */abstract function del ($ tb, $ wh = "1 limit 1 ", $ st = 0) ;}?> Interface learning example: