• 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

"There is no active transaction" when refreshing database in Laravel 8.0 test

phpseclib 2.0 can not use Composer to create autoload

echo language construct is discouraged. (PHP)

How to average columns of data from multiple, flat arrays?

how to upload binary image to sql server using php laravel

Unable to create lockable file - Laravel 8 & PHP 8

How do I remove this delivery notification from here?

How to loop sql table data inside a html table

mysql_result is defined but mysql_free_result warns it expected a resource

Laravel - Implicit route model binding with soft deleted data

php code to send checkbox form results to email

How can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

Update Total in checkout of Woocommerce with Ajax Request

PHP date() with timezone?

get attribute from class not working php 7

About Contact Privacy policy Terms and conditions