• 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

Pages are working fine on localhost but not running on the hosting server

Must be of the type array, null given,

Laravel Multi-language routes without prefix

Call to a member function fetch_field() on a non-object MySQLiDB

possible options to create pdf file using html elements to generate invoice in php and codeigniter

Sum array values

Cannot pass null argument when using type hinting

args[max_input] woocommerce if statement confused

Install mysql client in docker image

How can I create a Download Page with post php method?

Merge column values from two arrays to form an indexed array of associative arrays

Nginx RTMP not recording

Symfony autowiring issues since docker update

ORA-12546: TNS:permission denied error connection to remote oracle server

Star and Half Star Rating in Laravel

About Contact Privacy policy Terms and conditions