Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Montt on
I'm creating a new module.
In a part of my newmodule.module I have a array that I have to sent to a file php.
For this reason I do in newmodule.module:
$_SESSION['array']=$b;
$b is the array generated for my module.
What is the code in file php for capture $_SESSION['array']?
I do a simple file php for view the result of the recovery of $_SESSION['array'] but it is empty.
The code of file php is:
session_start();
$b=$_SESSION['array'];
print_r($b);
This code works perfectly for 'send' $_SESSION from a file php to other file php, but in this case don't works.
Any solution or idea that I must do to recover $_SESSION ?
Very Thanks
Comments
Drupal uses its own session handlers
Drupal uses its own session handlers and stores session data in database. You would have to do something like this:
Doubt is the beginning, not the end of wisdom.
I'm looking into it
I copy your code and I add:
echo("I'm solving problem with $_SESSION");
My problem now is this:
- The lines: require_once './includes/bootstrap.inc' and drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); provokes screen in target.
If I elimate this line I view: I'm solving problem with $_SESSION
I don't understand where is the problem, I use require_once other occasions and don`t cause problems.