Non ho capito una cosa di Try Throw Catch....
nel seguente codice:
Codice PHP:
<?php
try {
if(!@include('/path/to/file.php')) {
throw new Exception('Failed to load blabla');
}
}
catch(Exception $e) {
print $e->getMessage();
}
?>
Se cerco di personalizzare il Throw "MyException", (per poter gestirne più di uno nello stesso blocco di codice), non funziona, esempio sotto:
Codice PHP:
<?php
try {
if(!@include('/path/to/file.php')) {
throw new MyException('Failed to load blabla');
}
}
catch(MyException $e) {
print $e->getMessage();
}
?>
Come posso invocare un Throw personalizzato?
grassie