php - try, catch, and retry

后端 未结 6 2126
一向
一向 2020-12-23 19:49

Sometimes my code breaks and it is out of my control

How would I do the following?

try {
//do my stuff
}
catch {
//sleep and try again
}
         


        
6条回答
  •  無奈伤痛
    2020-12-23 20:23

    To be able to catch an exception you have to first throw one. Something like this.

    getMessage(), "\n";
    }
    
    // Continue execution
    echo "Hello World\n";
    ?>
    

    There are certain built in exceptions : http://php.net/manual/en/spl.exceptions.php

提交回复
热议问题