• 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

mysql_result is defined but mysql_free_result warns it expected a resource

Custom post type single page not working

Access relation of pivot table in Laravel

How do I loop through an MS SQL database with VB.NET?

Filter array by skipping every nth element from the end

Component install error: JInstaller: :Install: File does not exist

How to read laravel_session cookies saved in cookie memory of browser in client side?

How to get monthly wise data in laravel

Can't find vendor/autoload.php for Ratchet

How to add class name to an existing tag in php

Put content of wordpress page inside div

PHP date() with timezone?

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

Laravel Database Strict Mode

Laravel Sanctum CSRF not authenticating

About Contact Privacy policy Terms and conditions