I want to dump request variables to a file for debugging. How\'s this possible?
Use serialize()
function for dumping. Dump $_SERVER
, $_COOKIE
, $_POST
and $_GET
separately (may go to the same file). If you're planning on debugging with the data it helps to know if the data was part of a POST request or a GET request.
Dumping everything is good for debugging in development, but not so in production. If your application does not have many users, it can work in production too. If you anticipate many users, consider dumping just the $_POST
data, or limit server variables to those starting with HTTP_.