Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/04/2010, 16:51
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Capturar errores con exepciones

Las funciones nativas de PHP no generan excepciones, a lo mucho tendrías que hacer algo así:
Código PHP:
Ver original
  1. try {
  2.       $fh = @fopen($file, "w");
  3.       if (!is_resource($fh)) {
  4.              throw new Exception("no se pudo abrir achivo $file");
  5.       }
  6.       fputs($fh, $content);
  7.       //etc.
  8. } catch( Exception $e) {
  9.        echo $e->getMessage();
  10. }

Saludos.