loading method based on URL
Posted
by
steeped
on Stack Overflow
See other posts from Stack Overflow
or by steeped
Published on 2012-10-28T16:39:08Z
Indexed on
2012/10/28
17:00 UTC
Read the original article
Hit count: 206
I am trying to build a small mvc-based application.
How do I call a method in a class based on a query string?
For example, the $_GET query string is being set as load_master_form
http://www.domain.com/settings/load_master_form
And to call the method within the settings class, I am doing:
function __construct(){
$this->{$_GET['method']}();
}
But obviously that doesn't work - it just isn't possible to load a method like that. So how would it be done?
© Stack Overflow or respective owner