为什么显示找不到方法
function 中:
function C($name,$method){
require_once ($name.'Controller.class.php');
// eval('$obj=new'.$name.'Controller;$obj->'.$method.'();');
$controller=$name.'Controller';
$obj=new $controller();
$obj->method();
}
index中:
<?php
//url形式 index.php?controller=控制器名&method=方法名;
require_once ('function.php');
$controllerAllow=array('test','index','show');
$methodAllow=array('test','index','show');
$controller=in_array($_GET['controller'],$controllerAllow)?daddslashes($_GET['controller']):'index';
$method=in_array($_GET['method'],$methodAllow)?daddslashes($_GET['method']):'index';
$a=C($controller, $method);
echo $a;
?>
文件都在同级目录
显示错误:
Fatal error: Uncaught Error: Call to undefined method testController::method() in D:\UPUPW_AP7.0\htdocs\MVC\function.php on line 7
( ! ) Error: Call to undefined method testController::method() in D:\UPUPW_AP7.0\htdocs\MVC\function.php on line 7
Call Stack
求解决