• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

how can I set a session variable in Drupal 8 and get it in a php script?

phpsessiondrupalsession-variables


PHP Snippet 1:

$tempstore = \Drupal::service('tempstore.private')->get('your_module_name');
$tempstore->set('value', 'hi');

PHP Snippet 2:

$tempstore = \Drupal::service('tempstore.private')->get('your_module_name');
$some_data = $tempstore->get('value');

Related Snippets

How to load Codeigniter 4 lang file into an array variable

401 Unauthorized only occurring on some pages in Laravel 8

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

Laravel Database Strict Mode

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

MISSING UPDATES FOR: MEDIA Drupal 9

MySQL default time format UTC or GMT?

Why does using salted hash on python and php give me different results?

Creating command to backup MySql database in Laravel

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

Ajax GET request fails in laravel 8

How to install php_imagick on wamp64

shell errors running php exec

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

About Contact Privacy policy Terms and conditions