<?php
echo 'testClass';
echo '<br><hr>';
$className = 'TestClass';
$methodName = 'c_out';
$newObj = new $className();
if(method_exists($newObj,$methodName))
{
$newObj ->$methodName(123);
}
else
{
echo '要调用的方法在对象中不存在';
}
class TestClass
{
public function c_out($a)
{
echo 'this is c_out'.$a;
}
}
?>