Home  >  Article  >  php教程  >  PHP 动态调用方法实例代码

PHP 动态调用方法实例代码

WBOY
WBOYOriginal
2016-06-13 10:40:221132browse

PHP 动态调用方法实例代码如下:
 require_once showErrMsg.php;
 $_action = (isset($_REQUEST[action])?$_REQUEST[action]:"");
 if($_action!=null&&$_action!=){
  if(function_exists($_action)){
   eval("$_action();");
  }else{
   die(showErrMsg ( "
当前php文件中不存在方法[".$_action."()]。"));
  }
 }
?>

function showErrMsg($strMsg){
  return "".$strMsg."";
 }
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn