(PHP 5, PHP 7, PHP 8)
ReflectionMethod::__toString — 傳回 Reflection 方法物件的字串表示
此函式沒有參數。
此 ReflectionMethod 實例的字串表示。
範例 #1 ReflectionMethod::__toString() 範例
<?php
class HelloWorld {
public function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
echo $reflectionMethod;
?>
以上範例會輸出
Method [ <user> public method sayHelloTo ] { @@ /var/www/examples/reflection.php 16 - 18 - Parameters [1] { Parameter #0 [ <required> $name ] } }