All session data is accessible from a PHP script via the $_SESSION array. Because the data itself is stored on the server-side, you can write session data and read it in the next PHP statement, without the requirement of a round-trip to the server as it was with cookies. Just remember to call session_start() first and then access $_SESSION. The preceding listing creates a session file that Figure 5.6 shows. Figure 5.6. The content of the session file created by Listing 5.16. |