nadeemshafi9 Posted February 24, 2009 Share Posted February 24, 2009 hi guys im trying to pass an argument to my method using reflections but it says Warning: Missing argument 1 for Music::byTitle() in C:\xampp\htdocs\x\inc.services.php on line 8 here is my service HTTP handler include("inc.services.php"); //$invoke = $_GET['invoke']; $args = $_GET['args']; $method = new ReflectionMethod('Music', 'all'); $method->invoke(NULL); $method = new ReflectionMethod('Music', 'byTitle'); $method->invoke($args); here is the service class itself class Music { function Music(){ } final public static function all(){ echo "method all<br>"; } final public static function byTitle($args){ echo "method byTitle<br>"; } } any help much appreciated Link to comment https://forums.phpfreaks.com/topic/146728-solved-reflections-method-invoke-argument-passing-help/ Share on other sites More sharing options...
nadeemshafi9 Posted February 24, 2009 Author Share Posted February 24, 2009 i figured it out its $method->invoke('Music', $args); Link to comment https://forums.phpfreaks.com/topic/146728-solved-reflections-method-invoke-argument-passing-help/#findComment-770329 Share on other sites More sharing options...
rhodesa Posted February 24, 2009 Share Posted February 24, 2009 what are you trying to accomplish with this? Link to comment https://forums.phpfreaks.com/topic/146728-solved-reflections-method-invoke-argument-passing-help/#findComment-770331 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.