public function load_model($path = '') { if ($path == '') { $this->c->model = get_instance('Model'); return true; } $model = separate($path, array(NULL, NULL)); $file = MODELS_PATH . $model[0] . DS . $model[1] . '.php'; $class = $model[1] . MODEL_SUFIX; if (file_exists($file)) { require_once $file; if (class_exists($class)) { $this->c->{$class} = new $class(); } else { error('no_class', ${$class}, 'Model'); } } else { error('no_file', $file, 'Model'); } }
function separate($n) { if ($n >= 10) { $a = ($n - $n % 10) / 10; separate($a); } echo $n % 10; echo ' '; return; }