public static function __callStatic($method, $params)
{
if (empty($params[0])) {
return '';
}
//获取类型
$type = substr($method, 0, strlen($method) - 6);
switch (strtolower(substr($method, -6))) {
case 'encode':
$config = empty($params[1]) ? [] : $params[1];
return self::encode($params[0], $type, $config);
case 'decode':
$assoc = empty($params[1]) ? true : $params[1];
$config = empty($params[2]) ? [] : $params[2];
return self::decode($params[0], $type, $assoc, $config);
default:
throw new Exception("call to undefined method {$method}");
}
}