Request Environment
Request Environment
Every HTTP request (usually originated by a browser) contains additional information regarding the request such as header data, files, variables, etc. A web based application needs to parse that information so as to provide the correct response back to the requester. Phalcon\Http\Request encapsulates the information of the request, allowing you to access it in an object-oriented way.
// Getting a request instance $request = new \Phalcon\Http\Request(); // Check whether the request was made with method POST if ($request->isPost() == true) { // Check whether the request was made with Ajax if ($request->isAjax() == true) { echo "Request was made using POST and AJAX"; } }
Getting Values
PHP automatically fills the superg