//Get ID get content, call XML method Public functionget () {$id=$_get[' ID '];//Receive ID$User= M (' user ');//$val->where ("id = $id")->select ();$data=$User->where ("id =$id")find ();$this->arrtoxml ($data);//dump ($val);//dump ($id);}//encapsulated into XML Public functionArrtoxml ($data,$dom=0,$item=0){if(!$dom){$dom=NewDOMDocument ("1.0");}if(!$item){$item=$dom->createelement ("CTI");$dom->appendchild ($item);}foreach($data as $key=$val){$itemx=$dom->createelement (is_string($key)?$key: "Item");$item->appendchild ($itemx);if(!Is_array($val)){$text=$dom->createtextnode ($val);$itemx->appendchild ($text);}Else{$this->arrtoxml ($val,$dom,$itemx);}}Header(' Content-type:text/xml ');d UMP ($dom-savexml ());}//Get ID get content, call JSON method Public functionfind () {$id=$_get[' ID '];//Receive ID$User= M (' user ');//$val->where ("id = $id")->select ();$data=$User->where ("id =$id")find ();$this->json ($data);//dump ($val);//dump ($id);}//Encapsulating JSON Methods Public functionJson$data){foreach($data as $key=$value){$jobj-$key=$value;}//Print_r ($jobj);//Print the object after passing the property//echo ' use $jobj->row[0][\ ' code\ '] to output the array element: '. $jobj->row[0][' code '. ' <br> ';Echo' Encoded JSON string: '. Json_encode ($jobj).‘ <br> ';//Print the encoded JSON string}//Get ID and account get content and show it Public functionun () {$account=$_get[' Account '];//Receive Account$id=$_get[' ID '];//Receive password$User= M (' user ');//$condition = new StdClass ();$condition[' account '] =$account;$condition[' id '] =$id;//$val->where ("id = 1")->select ();$User->where ($condition),find ();//$this->json ($data);Dump$_get);d UMP ($User);d UMP ($condition);}//get account and password, call the JSON method Public functionUp () {$account=$_get[' Account '];//Receive Account$password=$_get[' Password '];//Receive password$User= M (' user ');//$condition = new StdClass ();$condition[' account '] =$account;$condition[' password '] =$password;//$val->where ("id = 1")->select ();$data=$User->where ($condition),find ();//$this->json ($data);//dump ($_get);//dump ($User);//dump ($condition);$this->json ($data);}
thikphp Simple Interface Skeleton