• 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

How to Display Data in Yajra Datatables Laravel 7?

Changing font color in javascript

Dynamic dropdown Ajax PHP request

Laravel update hasMany relationship using saveMany

How to insert data from multiple select dropdown values into database?

How to add a custom field to all Woocommerce attribute terms using add_action

How to get transaction details in notify_url page in paypal

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

Transpose and flatten multiple rows of array data [duplicate]

Check If array is null or not in php

Getting output of MS stored procedure on php call

I cannot create a auto generated date time in mysql workbench

How do I call Validator from a namespace with an already existing Validator class

Facebook API, get page post link (PHP)

Return new collection without modifying original collection

About Contact Privacy policy Terms and conditions