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