Home > Article > Backend Development > PHP dynamic calling method example code_PHP tutorial
The example code of PHP dynamic calling method is as follows:
require_once showErrMsg.php;
$_action = (isset($_REQUEST[action])?$_REQUEST[action]:"");
if($_action!=null&&$_action!=){
if(function_exists($_action)){
eval("$_action();");
}else{
die(showErrMsg ( "
The method [".$_action."()] does not exist in the current php file."));
}
}
?>
function showErrMsg($strMsg){
Return "".$strMsg."";
}
?>