我怎么知道另一个类的方法需要多少参数? PHP

Example:

file: \bla\test1.php

class Test {

    public function Hello($one) {

    }
}

file: \bla2\test2.php

class World {

    public function GetNumberOfParameters($class, $method) {
       // output: number of parameters required of method Hello 
    }
}

You can use reflection to get the number of parameters. Something like:

$reflec = new ReflectionClass('Test');
$helloMethod = $reflec->getMethod('Hello');
echo "Number of params is: ".$helloMethod->getNumberOfParameters();

See here: http://php.net/manual/en/class.reflectionclass.php

I'd consider why you want to do this however. I can think of very few cases where this would be of any use.

Example: http://codepad.org/zWca7mFz