Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 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('Exception');
  6.     }
  7. } catch (\Exception $e) {
  8.     // Запись в лог информации для устранения ошибки    
  9.     header('HTTP/1.1 500 Internal Server Error'); // По моему мнению, большинство клиентов при HTTP коде != 200, сделают повторный запрос
  10.     exit();
  11. }
  12. echo $response;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement