<?PHPif(!isset($_session)){ Session_Start();}include‘.. /common/mysql.class.php ';include‘.. /common/common_notice.php ';Try{ $arr=[]; $config=[]; $pdo=New Mysql($config); $game _id= (int) (Trim($_post[' game_id '])); $game _type= (int)$_post[' Game_type ']; $uid=s_session[' UID ']; if(!$game _type){ Throw New Exception(notice_num_41,0); } if(!$game _id){ Throw New Exception(notice_num_37,0); } if(!$uid){ Throw New Exception(notice_num_40,0); } $collection _time= Time();//Collection Time of the game $sql= "INSERT into ' ks_game_collection ' (' game_id ', ' collection_time ', ' game_type ', ' uid ') VALUES ('$game _id‘, ‘$collection _time‘,‘$game _type‘,‘$uid‘)"; $rs=$pdo->dosql ($sql); if($rs>0){ $arr=[' status ' =>1, ' notice_content ' =notice_num_38]; Exit(Json_encode ($arr,true)); }Else{ Throw New Exception(notice_num_39,0); }}Catch(Exception $e){ $arr=[' status ' =$e->getcode (), ' notice_content ' =$e-getMessage ()]; Exit(Json_encode ($arr,true));}
Catching exception operations in PHP