Jump to content

[SOLVED] Static functions and sessions


9three

Recommended Posts

I created a class that holds all my session handling for me. I'm having an issue where the parameters for the session is not being stored. The value however, is being returned correctly.

 

  public static function setSession($name, $id)
  {
    $_SESSION['$name'] = $id;
  }

 

So when I test this

 

require('session.class.php');

session::Start();
session::setSession(test, 1);

foreach ($_SESSION as $name => $value)
{
  echo $name;
  echo $value;
}

 

it out puts $name and 1. The correct values should be test, and 1.

Link to comment
https://forums.phpfreaks.com/topic/148041-solved-static-functions-and-sessions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.