I can't think of any way to parse each value of arg into new argument PHP: $args = ['arg1', 'arg2', 'arg3'];# Method 1foreach($args as $arg){ $class->function($arg);}# Method 2$class->function($args[0], $args[1], $args[2]);# Method 3$class->function($args[0].$args[1].$args[2]); I hope you understand that those methods above are useless and dumb
PHP: if(isset($_POST['api_key'])){ extract($_POST); $api = new Main($_POST); $r = $api->hasPermission($_POST['api_key']); if($r !== true){ __error($r); } else { if(isset($_POST['target'])){ # What class is the method reffering to... # For example &target=BanManager&action=isBanned&args=Steve if(class_exists($target)){ $s = new $target($api); if(isset($_POST['action'])){ if(method_exists($s, $action)){ // $response['response'] = $s->$action($args); } else { __error('007'); } } else { __error('006'); } } else { __error('005'); } } else { __error('004'); } } } else { die('You don\'t have access to this file!');}
Try: PHP: $class = new Example();$args = ['arg1', 'arg2', 'arg3'];$argument = "";foreach($args as $arg){ $argument .= $arg." ";}$class->function($argument);//Pretend this is the function:class Example { public function function($argument){ $args = explode(" ", $argument); // now has the args as array. //more code... }} theory
Not a bad idea but we have to add this code into each function then :/ Just give the function array of args? Btw, I made first successful request to API, today