• 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 8: Array to string conversion while calling route:list

PHP Imap , php 7.4.3 on mac osx catalina

Jquery DataTables: Data not displaying in table via Ajax

Laravel 5.1 Unknown database type enum requested

How can i hide dt if dd got empty value

SQL AVG() to 2 decimals

add " ? " in url via htaccess RewriteRule

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

PHP drop down list using array's and foreach (else and for) code

How to make a foreign key not using primary key

Laravel Schedule not sending email

LARAVEL: How to fetch id dynamically in a query builder?

How to add class name to an existing tag in php

How to find phpcs current default standard

How to delete old images from public folder on update using Laravel

About Contact Privacy policy Terms and conditions