Created
January 31, 2014 15:38
-
-
Save tanrax/8734400 to your computer and use it in GitHub Desktop.
PHP: Autocargador de bibliotecas (librerias)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Autocargador de librerias **/ | |
spl_autoload_register('autocargador'); | |
function autocargador($insNom) | |
{ | |
include $insNom . '.class.php'; | |
} | |
/** | |
* Clase que carga una librería | |
*/ | |
class HolaMundo | |
{ | |
public $miRestaurante = null; | |
function __construct() | |
{ | |
$this->miRestaurante = new Restaurante(); | |
echo $this->miRestaurante->iNum; | |
} | |
} | |
new HolaMundo(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment