PHP 教程:PHP 动态调用方法实例代码
<?php
require_once ‘showErrMsg.php’;
$_action = (isset($_REQUEST['action'])?$_REQUEST['action']:”");
if($_action!=null&&$_action!=”){
if(function_exists($_action)){
eval(“$_action();”);
}else{
die(showErrMsg ( “<br> 当 前 php 文 件 中 不 存 在 方 法 [<b>".
$_action."()</b>]
”
。 ));
}
}
?>
<?php
function showErrMsg($strMsg){
return “<font color=’red’>”.$strMsg.”</font>”;
}
?>