Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/03/2018, 04:05
quico5
 
Fecha de Ingreso: enero-2008
Mensajes: 580
Antigüedad: 16 años, 3 meses
Puntos: 9
Respuesta: POO, __destruct() no se carga de último

Hola @hhs, gracias por responder

Esa clase es llamada desde este archivo

Código PHP:
<?php spl_autoload_register(function($clase){include"$clase.php";});
        
        
# Probamos $_SERVER
        #print('<pre>');print_r($_SERVER);print('</pre>');
        
        # Definimos algunas constantes.
        
define('DS',DIRECTORY_SEPARATOR);
        
define('ROOT',realpath(dirname(__FILE__)).DS);
        
define('URL',dirname($_SERVER['PHP_SELF']));

        
# Definimos: Controlador, Modelo y Argumentos.
        
$args=array_filter(explode('/',filter_input(INPUT_GET,'url',FILTER_SANITIZE_URL)));
        
#print('<pre>'.$cont);print_r($args);print('</pre>');
        
$cont=strtolower(array_shift($args))?:'portada';
        
$metd=strtolower(array_shift($args))?:'index';
        
        
# Comprobamos que el Controlador es funcional.
        
$file=ROOT.'controller_'.$cont.'.php';
        
is_readable($file) ? require_once $file : exit('Controlador no disponible.') ;

        
# Comprobamos que el Metodo es funcioanl
        
$metd=method_exists(new $cont,$metd) ? $metd 'error' ;

        
# Pasamos los parametos al Controlador.
        #isset($args) ? call_user_func_array([$cont,$metd],$args) : call_user_func([$cont,$metd]) ;
        
call_user_func_array([$cont,$metd],$args);

?>
Tengo otro archivo que viene a ser una especie de core:

Código PHP:
<?php class html{


    public function 
head($titulo){include'html'.DS.__FUNCTION__.'.phtml';}
    public function 
foot(){include'html'.DS.__FUNCTION__.'.phtml';}
    public function 
nav(){include'html'.DS.__FUNCTION__.'.phtml';}
    public function 
card($figcaption,$img){include'html'.DS.__FUNCTION__.'.phtml';}

}