A section of PHP exceptions

Source: Internet
Author: User

This is a piece of code that I wrote, inside the PHP exception function, the error code to display errors when the line is displayed. When the user action error, give me, I can quickly have to track and troubleshoot errors!

 Public functionAdded_business_submit () {Try{        Extract($_post); if("' = =$title) Self::json (0,sprintf(Error_empty, ' ticket title ')); if("' = =$is _trusteeship) Self::json (0,sprintf(Error_empty, ' Server class ')); if("' = =$eqroom _id) Self::json (0,sprintf(Error_empty, ' location of the room ')); M ()-Starttrans (); $com _info= M (' company ')->where (Array(' Com_qyuserid ' =$com _qyuserid)),find (); $com _id=$com _info[' com_id ']; $com _name=$com _info[' Com_name ']; if(Empty($com _info))Throw New Exception(Error_notfound_user); $data=Array(            ' com_id ' =$com _id, ' com_name ' =$com _name, ' type ' = 1, ' Step ' = 1, ' poster ' + Self::$user[' name '], ' posttime ' = + Self::$datetime, ' Eqroom_name ' + D (' Equiproom ')->get_eqroom_name ($eqroom _id),        ); $data=Array_merge($data,$_post); $agent _id= M (' working_agent ')->add ($data); if(false===$agent _id)Throw New Exception(Error_submit); $result= D (' steplogagent ')->next_step ($agent _id,$remark); if(false===$result)Throw New Exception(Error_submit); }Catch(Exception $e) {M ()-rollback (); $this->exception_handle ($e); } M ()-commit (); Self:: JSON (1,success_submit);}Private functionException_handle (Exception $e){    $msg=$e-GetMessage (); $line=$e-GetLine (); //**/print_r ($e); Echo M ()->getlastsql ();    $name= Self::$user[' Name ']; $time= Self::$datetime; $sql= M ()Getlastsql (); $log=$time." ".$name.":{$msg}({$line}) {$sql}"; Self:: MyLog ($log, ' Agent '); Self:: JSON (0, "{$msg}({$line})");}

A section of PHP exceptions

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.