Request

// url: http://xx.com/aa/bb
 Request::url();
// path: /aa/bb
 Request::path();
// getRequestUri: /aa/bb/?c=d
 Request::getRequestUri();
// Returns user's IP
 Request::getClientIp();
// getUri: http://xx.com/aa/bb/?c=d
 Request::getUri();
// getQueryString: c=d
 Request::getQueryString();
// Get the port scheme of the request (e.g., 80, 443, etc.)
 Request::getPort();
// Determine if the current request URI matches a pattern
 Request::is('foo/*');
// Get a segment from the URI (1 based index)
 Request::segment(1);
// Retrieve a header from the request
 Request::header('Content-Type');
// Retrieve a server variable from the request
 Request::server('PATH_INFO');
// Determine if the request is the result of an AJAX call
 Request::ajax();
// Determine if the request is over HTTPS
 Request::secure();
// Get the request method
 Request::method();
// Checks if the request method is of specified type
 Request::isMethod('post');
// Get raw POST data
 Request::instance()->getContent();
// Get requested response format
 Request::format();
// true if HTTP Content-Type header contains */json
 Request::isJson();
// true if HTTP Accept header is application/json
 Request::wantsJson();

Last updated