swith case

if($method->getNumberOfParameters()>0 && C('URL_PARAMS_BIND')){
switch($_SERVER['REQUEST_METHOD']) {
case 'POST':
$vars    =  array_merge($_GET,$_POST);
break;
case 'PUT':
parse_str(file_get_contents('php://input'), $vars);
break;
default:
$vars  =  $_GET;
}
$params =  $method->getParameters();
$paramsBindType     =   C('URL_PARAMS_BIND_TYPE');
foreach ($params as $param){
$name = $param->getName();
if( 1 == $paramsBindType && !empty($vars) ){
$args[] =   array_shift($vars);
}elseif( 0 == $paramsBindType && isset($vars[$name])){
$args[] =   $vars[$name];
}elseif($param->isDefaultValueAvailable()){
$args[] =   $param->getDefaultValue();
}else{
E(L('_PARAM_ERROR_').':'.$name);
}   
}

你可能感兴趣的:(PHP,Class)