php - Add params to a class method call from GET -



php - Add params to a class method call from GET -

i have project uses mvcish pattern.

i have bootstrap file takes info find out controller load , method i'm stuck on part on how can pass additional parameters parameters method beingness called.

my current bootstrap index.php file looks this:

<?php // sessions session_start(); // config require('common/config.php'); // database require('common/db.php'); $_db = new db(); // web require('common/web.php'); // main require('cnt/main.php'); $main = new main($_db); // current controller/view $r = (isset($_get['r']) && $_get['r'] != '') ? $_get['r'] : 'site/index'; // check auth if($r != 'auth/index' && $r != 'auth/login'){ if(isset($_session['id'], $_session['token']) && $_session['id'] != null && $_session['token'] != null){ if(!$main->validateauth($_session['id'], $_session['token'])){ $main->redirect('auth/index'); } } else { $main->redirect('auth/index'); } } // render page $ep = explode('/', $r); $cnt = ucfirst($ep[0]); $action = 'action'.ucfirst($ep[1]); unset($_get['r']); if(!empty($_get)){ // additional parameters } include_once('cnt/'.$cnt.'.php'); $class = new $cnt($_db); $class->$action();

how can accomplish this?

php oop

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -