File tree Expand file tree Collapse file tree
user_guide_src/source/concepts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11##########################
2- Working With HTTP Requests
2+ Working with HTTP Requests
33##########################
44
55In order to get the most out of CodeIgniter, you need to have a basic understanding of how HTTP requests
Original file line number Diff line number Diff line change 22
33use CodeIgniter \HTTP \IncomingRequest ;
44
5- $ request = service ( ' request ' );
5+ $ request = request ( );
66
7- // the URI being requested (i.e., /about)
7+ // the URI path being requested (i.e., /about)
88$ request ->getUri ()->getPath ();
99
1010// Retrieve $_GET and $_POST variables
2222$ request ->getServer ('Host ' );
2323
2424// Retrieve an HTTP Request header, with case-insensitive names
25- $ request ->getHeader ('host ' );
26- $ request ->getHeader ('Content-Type ' );
25+ $ request ->header ('host ' );
26+ $ request ->header ('Content-Type ' );
2727
28- $ request ->getMethod (); // get, post, put, etc
28+ // Checks the HTTP method
29+ $ request ->is ('get ' );
30+ $ request ->is ('post ' );
Original file line number Diff line number Diff line change 22
33use CodeIgniter \HTTP \Response ;
44
5- $ response = service ( ' response ' );
5+ $ response = response ( );
66
77$ response ->setStatusCode (Response::HTTP_OK );
88$ response ->setBody ($ output );
You can’t perform that action at this time.
0 commit comments