Skip to content

Request::requestForSAPI

Mo McRoberts edited this page Aug 7, 2011 · 1 revision

Return an instance of a Request class for a specified SAPI.

Synopsis

uses('request');

public static function Request [[Request]]::requestForSAPI(string [in,optional] $sapi = null)

Description

Requests are encapsulated as one of several descendants of the [[Request]] class, depending upon the SAPI in use. If no SAPI name is specified when calling Request::requestForSAPI(), the current SAPI name as identified by PHP (using php_sapi_name) will be used. Additionally, if REQUEST_CLASS is defined and no SAPI name is specified, an instance of the class named by REQUEST_CLASS will be created instead of the default for the current SAPI.

Parameters

Name Direction Type Description
$sapi in,optional string The name of the SAPI to return an instance for

Return Value

An instance of a request class matching the specified or default SAPI.

Clone this wiki locally