1
This commit is contained in:
parent
cdb8e9206e
commit
e6ff8b6031
@ -22,6 +22,12 @@ function autoload_controller__($classname)
|
||||
}
|
||||
spl_autoload_register('autoload_controller__');
|
||||
|
||||
function isValidActionAction($a, $method) {
|
||||
return $method && $method->isPublic() &&
|
||||
$a[0] != '_' &&
|
||||
(!$method->isConstructor() && !$method->isDestructor());
|
||||
}
|
||||
|
||||
try{
|
||||
$c = $_REQUEST['c'];
|
||||
$a = $_REQUEST['a'];
|
||||
@ -37,12 +43,19 @@ try{
|
||||
$beginTick = phpcommon\getTickCount();
|
||||
$obj = eval('return new $classname();');
|
||||
$method = new ReflectionMethod($classname, $a);
|
||||
if ($method && $method->isPublic() &&
|
||||
$a[0] != '_' &&
|
||||
(!$method->isConstructor() && !$method->isDestructor())) {
|
||||
$methodS = new ReflectionMethod($classname, $a . 'S');
|
||||
if (isValidActionAction($a, $method)) {
|
||||
$obj->_handlePre();
|
||||
$method->invoke($obj);
|
||||
$obj->_handlePost();
|
||||
} else if (isValidActionAction($a, $methodS)) {
|
||||
//如果原版函数不存在并且S版函数存在,则自动切换为S版
|
||||
echo json_encode(array(
|
||||
'errcode' => 1006,
|
||||
'errmsg' => 'already upgrade to safe api',
|
||||
'payload' => 1,
|
||||
));
|
||||
die();
|
||||
}
|
||||
} catch (Exception $e){
|
||||
error_log($e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user