• 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

Using Associative arrays

Show rotation of tweets using current day of month

How do I enable error reporting in Laravel?

Project structure for PHP

unable to load your default controller on Codeigniter

How to display table header in every page using FPDF library?

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

Creating Combinations of Elements

Get image type from base64 encoded src string

Laravel lang slug in url

Add bold text and line break into Laravel Notification Email

Pass an image through AJAX [duplicate]

php retrieve specific data onclick from database in a list format

Yii2 select2 database exception number of bound variables does not match number of tokens

Clear javascript source cache laravel 5.8

About Contact Privacy policy Terms and conditions