• 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 post contact form giving me error 419

Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path: ) in Unknown on line 0

How to get the ID of the link in another page in php

Limit WooCommerce products in cart only from one custom taxonomy

Yii2: How to download backup files using spanjeta/yii2-backup?

VB.NET WebRequest with PHP POST

generate an Excel file using PHP

If action is on a different page do I use fwrite function

Target class controller does not exist - Laravel 8

Creating Combinations of Elements

Smarty: undefined extension class 'Smarty_Internal_Method_Get_Template_Vars'

Remove country code from phone number?

php - add comma thousands separator but remove trailing zeros

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

Laravel php artisan serve to mimic HTTPS

About Contact Privacy policy Terms and conditions