Requests_Exception_()

最后更新于:2021-11-26 02:41:20

Requests_Exception_( int|bool$code)

Get the correct exception class for a given error code

参数

$code

(int|bool) (Required) HTTP status code, or false if unavailable

响应

(string) Exception class name to use

源文件

文件: gc-includes/Requests/Exception/HTTP.php

	public static function get_class($code) {
		if (!$code) {
			return 'Requests_Exception_HTTP_Unknown';
		}

		$class = sprintf('Requests_Exception_HTTP_%d', $code);
		if (class_exists($class)) {
			return $class;
		}

		return 'Requests_Exception_HTTP_Unknown';
	}