Location: PHPKode > projects > litephp > litephp-master/c.class.php
<?php
class C{

	private static $pro=array();//array 属性名字=>该属性的对象
	
	function __get($name)
	{
		if($name==='tpl' or $name==='input')
		{
			require_once(CORE_PATH.'lib/'.$name.'.class.php');
			if(!isset(self::$pro[$name])) self::$pro[$name]=new $name;
			return self::$pro[$name];
		}
		fatal_error('unknow lib:'.$name);
	}

	static function run()
	{
		$c=isset($_GET['c'])?$_GET['c']:'index';//defaut:'index'
		$a=isset($_GET['a'])?$_GET['a']:'index';

		unset($_GET['c']);
		unset($_GET['a']);

		$obj=C($c);

		if(!method_exists($obj,$a)) fatal_error('method not found:'.$a);//check a

		$obj->$a();
	}
}
Return current item: litephp