thikphp Simple Interface Skeleton

Source: Internet
Author: User

//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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.