PHP: Tracking session variable content while developing

I like using session variables to track various and sundry as users navigate through my sites.

The problem comes when I forget to change, or load a session variable.

What I used to do was add var_dump($_SESSION) lines to my scripts…but of course, then you have to go remove them.

This weekend I thought of a cleaner way.

I create a whole new file, usually sessvar.php. I then point my browser to it, and whenever I need to see what the session variables are, I simply refresh the page.

So, you’d navigate to yourpageurl/sessvar.php in a tab besides what ever you’re using to check your work, and refresh the sessvar.php page whenever you needed to see what variables your stored were.

<?php

session_start();

var_dump($_SESSION);

?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s