I want to be able to call my php class via an http post. So I came up with this.
$method = $_POST['method'];
$data = $_POST['data'];
$class_methods = get_class_methods('myclass');
if($method, $class_methods){
$save = $myclass::$method($data);
echo $save;
}
Is there any global methods that exist on classes in general that might allow someone to call a method I have not defined?
Thanks all.
If I understand you correctly, have a look at:
http://php.net/manual/en/language.oop5.magic.php
Constructs like:
are also possible, and on PHP 5.3+ you can do:
directly.