• 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

Add and update products to session cart in Laravel

PHP Get value from JSON [duplicate]

How to remove index.php and index from the URL using htaccess | PHP

How to remove Deprecated SymfonyComponentDebugDebugClassLoader?

Fetch files from next cloud storage and display in Laravel website

onKeyUp event calculation not working on the following rows from php generated forms except the first one

enroll_table three field fetch to payment form to create payment field in laravel 5.5

HTML and PHP in one file

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

Composer Script echo

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

How can I get new CSRF token in LARAVEL by using ajax

No result using makeStyles Material UI in react 18

How to run or debug php on Visual Studio Code (VSCode)

About Contact Privacy policy Terms and conditions