@froschdesign,
Hi Froschdesign, sorry for bothering you again. I found I got a empty string when I call the getId() method.
The following is my code for your reference:
modules.config.php
return [
'Zend\Paginator',
'Zend\Navigation',
'Zend\ServiceManager\Di',
'Zend\Session',
'Zend\Mvc\Plugin\Prg',
'Zend\Mvc\Plugin\Identity',
'Zend\Mvc\Plugin\FlashMessenger',
'Zend\Mvc\Plugin\FilePrg',
'Zend\Mvc\I18n',
'Zend\Mvc\Console',
'Zend\Log',
'Zend\Form',
'Zend\Cache',
'Zend\Db',
'Zend\Router',
'Zend\Validator',
'Application',
'Album',
'Blog',
'Admin',
'Api',
];
global.php
(before, I use exactly the same with the code you give as configuration. empty seession_id I got, so I changed to the following, still got an empty string via ->getId() method)
'session_config' => [
'remember_me_seconds' => 1800,
'name' => 'wendang',
'use_cookies' => true,
],
'session_storage' => [
'type' => SessionArrayStorage::class,
],
module.config.php
is this equal to the factories configuration in the module.config.php?
'controllers' => [
'abstract_factories' => [
LazyControllerAbstractFactory::class
],
],
Then my controller construction method like:
class ImagedragauthController extends AbstractActionController
{
private $container;
private $sessionManager;
public function __construct(ServiceManager $container, SessionManager $sessionManager)
{
$this->container = $container;
$this->sessionManager = $sessionManager;
}
//****here I passed the $this->sessionManager to a model function as a param, and use this param in the model function as follow***//
}
concrete code using in my demo:
public function validation($container, $sessionManager)
{
$sessionId = $sessionManager->getId();
var_dump($sessionId);exit; //output string(0) "" in the browser
}
output string(0) “” in the browser
Any idea? I thought I can get a long string. Pls tell me.