按照老师的代码打,老是报错是怎么回事
<?php
require_once('function.php');
$controllerAllow=array('test','index');
$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';
C($controller,$method);
?>
<?php
function C($name,$method){
require_once('/libs/Controller/' .$name. 'Controller.class.php');//引入controller类
eval('$obj=new '.$name.'Controller();$obj->'.$method.'();');
function M($name){
require_once('/libs/Model'.$name.'Model.class.php');
eval('$obj=new '.$name.'Model;');
return $ogj;
}
function V($name){
require_once('/libs/View'.$name.'View.class.php');
eval('$obj=new' .$name.'View();');
return $obj;
}
//转义字符,过滤非法字符
function daddslashes($str){
return(!get_magic_quotes_gpc())?addslashes($str):$str;
}
}
?>