PHP try-catch not working

后端 未结 5 565
慢半拍i
慢半拍i 2020-12-16 10:51
try     
{
    $matrix = Query::take(\"SELECT moo\"); //this makes 0 sense

    while($row = mysqli_fetch_array($matrix, MYSQL_BOTH)) //and thus this line should be          


        
5条回答
  •  既然无缘
    2020-12-16 11:28

    You can't handle Warnings/Errors with try-catch blocks, because they aren't exceptions. If you want to handle warnings/errors, you have to register your own error handler with set_error_handler.

    But it's better to fix this issue, because you could prevent it.

提交回复
热议问题