i little confuse. want know best solution. should have initiate session in bootstrap like:
protected function _initsession() { zend_session::start(); $session = new zend_session_namespace() ; zend_registry::set("session", $session) ; } and call session object in controller
$session = zend_registry::get("session") ; or option create session object each time need in controller
$session = new zend_session_namespace(); i want know difference? there memory issue or performance issue asuming when create object each time needs space in memory :p , zend_registry creates object once in memory :d think ?
thanks! best regards
zend_registry used store objects/values current request. in short, commit registry in index.php can accessed other controllers/actions (because every request first routed index.php bootstrapper via .htaccess file). config parameters , db parameters prepped global use using zend_registry object.
zend_session_namespace uses php sessions. data stored using zend_session can accessed in different/all pages. so, if want create variable named ‘userrole’ in /auth/login script , want accessible in /auth/redirect, use zend_session.
for example
if have db object stored in registry, , when access page login page, particular db object accessible of files used in page (to construct), meaning global access (same keyword in php scope variable).
whereas, session scope means can access anywhere on page until close browser (until session get’s destroyed).
edit
zend_session working session extension in php.this tracking loggin in user(s), etc.
zend_registry used store objects / resources / etc in @ runtime. idea want use maybe 1 config object, or 1 database throughout entire application. do, when create these objects, assign them registry.
it depends on requirement, in type want utilize both of them.
i hope clear now.
Comments
Post a Comment