How does one store and retrieve custom session variables in Drupal 6?

前端 未结 1 1659
孤独总比滥情好
孤独总比滥情好 2021-02-13 19:27

Drupal employs a custom session handler that changes the familiar...:

$_SESSION[\'foo\'] = \'bar\';
echo $_SESSION[\'foo\'];

...behavior. The a

1条回答
  •  感情败类
    2021-02-13 19:43

    Ok, here's the answer - $_SESSION works for authenticated users as well as anonymous users as expected - if there are no other problems!

    I discovered that I had the following problem; my Drupal "users" table (or in my case "drupal_users") was missing a user with a UID of zero ("0").

    Drupal uses UID 0 to manage sessions in a database via its custom session handler. If that user doesn't exist in the table (it should be there by default installation), then Drupal cannot attach session information to the anonymous user.

    0 讨论(0)
提交回复
热议问题