Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlan Mattanó
Courses Plus Student 12,188 PointsDo SESSION work in Treehouse Workspaces?
My code:
index.php
<?php session_start();
$_SESSION['data'] = "hello world!";
var_dump( $_SESSION );
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
exit;
?>
In page2.php
<?php session_start();
var_dump( $_SESSION );
exit;
?>
2 Answers
Marcus Parsons
15,719 PointsHey Alan,
Unfortunately, they don't in Workspaces. But you can use a local environment to test your session code. I use XAMPP for my local server, and I love it.
Alan Mattanó
Courses Plus Student 12,188 PointsTHX Marcus! I was trying and trying... I will use xampp
Marcus Parsons
15,719 PointsYou're welcome, Alan! I actually had to test this to make sure myself, because I hadn't yet tried to use session variables in Workspaces yet lol Your code works great on my local server but not in workspaces :\ Oh well, now you can test your session code! =]