• 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 validate form data in codeigniter 4

How to implement placeholder in a php file for moodle plugin?

I can't delete my image when it is liked because of the foreign key in mysql

Post Form Data To phpmyadmin Database

PHP block shortcut in Visual Studio Code

Facebook API, get page post link (PHP)

How to get total pages of PDF with FPDF?

PHP my timezone is no setting up in PHP.ini File in xampp

Wordpress wpdb->delete issue

Can we define variables in `.tpl` files?

Split comma separated value from table column into rows using mysql?

Toggle between a textbox and a select using PHP

retrieve data from database using session

Chunk and transpose a flat array into rows with a specific number of columns

Connecting an HTML webpage to a SQL Server

About Contact Privacy policy Terms and conditions