<?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; } } ?>

 

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2021-08-06
  • 2021-09-13
  • 2021-10-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案