• 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

Use same method for inertia response and json response Laravel Jetstream

Laravel Blade checkbox not checked

Class AppHttpControllersUserController Does Not Exist

file_put_content...fail to open stream:Permission denied in Laravel 5

Array to string conversion

AJAX call fails with SyntaxError: Unexpected end of JSON input

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

Fatal error: Trait 'LaminasDbAdapterLaminasDbAdapterAdapterInterface' not found in /var/www/vendor/laminas/laminas-db/src/Adapter/Adapter.php

phpunit - testing is painfully slow

how to upload binary image to sql server using php laravel

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

Can I write PHP code across multiple lines per statement?

Unable to uninstall brew php from homebrew

Failing validation doesn't stop code execution in livewire component

enable Apache http Authorization header

About Contact Privacy policy Terms and conditions