Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. $response = '{"errorId":0';
  2.         try {
  3.             json_decode($response);
  4.             if (json_last_error() !== JSON_ERROR_NONE) {
  5.                 throw new \Exception('Информация для устранения ошибки');
  6.             }
  7.         } catch (\Exception $e) {
  8.             // log exception
  9.             // По моему мнению, большинство клиентов при HTTP коде != 200, сделают повторный запрос
  10.             header('HTTP/1.1 500 Internal Server Error');
  11.             exit();
  12.         }
  13.         echo $response;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement