php: try-catch not catching all exceptions

后端 未结 4 1037
-上瘾入骨i
-上瘾入骨i 2020-12-23 17:34

I\'m trying to do the following:

try {
    // just an example
    $time      = \'wrong datatype\';
    $timestamp = date(\"Y-m-d H:i:s\", $time);
} catch (Ex         


        
4条回答
  •  既然无缘
    2020-12-23 17:59

    try {
      // call a success/error/progress handler
    } catch (\Throwable $e) { // For PHP 7
      // handle $e
    } catch (\Exception $e) { // For PHP 5
      // handle $e
    }
    

提交回复
热议问题