• 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

Using PHP to connect to a remote MSSQL database

What is PHP's equivalent of JavaScript's "array.every()"?

"cannot list resources" error from WooCommerce REST API

get folder directory from input type file - PHP

How to install php yaml on CentOs?

How to get AJAX to post on second page?

Can I write PHP code across multiple lines per statement?

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

How to show selected value using javascript in laravel

Inserting data into SQL Server Db An Invalid direction was specified

unable to load your default controller on Codeigniter

Prestashop cUrl Login

How to get monthly wise data in laravel

Check if my GET request has Header: Token

Redirect to previous page with php

About Contact Privacy policy Terms and conditions