• 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

Laravel Command Schedule Not Working Properly

Timber: Single post pagination does not work (wp_link_pages)

Problem with fetching data from database in Laravel

Chunk and transpose a flat array into rows with a specific number of columns

Install mysql client in docker image

Ajax GET request fails in laravel 8

Mysqli Output to a table

array_map triple dimensional array [duplicate]

How to install ZeroMQ for PHP on an Alpine Linux container?

How to access a var with "-" in PHP [duplicate]

Add record for each array elements if missing in table

Add Class in html Dynamically in PHP

php retrieve specific data onclick from database in a list format

file_put_content...fail to open stream:Permission denied in Laravel 5

Explode not working properly with dash

About Contact Privacy policy Terms and conditions