Variables passed via session from a ZEND page to a PHP native page
Do you think is it possible from a开发者_C百科 Zend session to pass a variabiles to a php native page session? The 2 pages are on the same server on the same domain, because I don't want to send the variables through the url. Thx!!
In the Zend framework documentation for basic session usage it states that:
Zend_Session_Namespace instances provide the primary API for manipulating session data in the Zend Framework. Namespaces are used to segregate all session data, although a default namespace exists for those who only want one namespace for all their session data. Zend_Session utilizes ext/session and its special $_SESSION superglobal as the storage mechanism for session state data. while $_SESSION is still available in PHP's global namespace, developers should refrain from directly accessing it, so that Zend_Session and Zend_Session_Namespace can most effectively and securely provide its suite of session related functionality.
Each instance of Zend_Session_Namespace corresponds to an entry of the $_SESSION superglobal array, where the namespace is used as the key.
$myNamespace = new Zend_Session_Namespace('myNamespace'); // $myNamespace corresponds to $_SESSION['myNamespace']
It is possible to use Zend_Session in conjunction with other code that uses $_SESSION directly. To avoid problems, however, it is highly recommended that such code only uses parts of $_SESSION that do not correspond to instances of Zend_Session_Namespace.
In my classic php I always wrote:
session_start();
$_SESSION['name'] = 'myname';
and into the second page:
session_start();
echo $_SESSION['name']
and everything works fine. Now into the zend page (if I understood) I should write:
$myNamespace = new Zend_Session_Namespace('myname');
but in the second php native page? Bit confused... sorry and thank you.
ps. In the bootstrap of course there is the Zend_Session::start()
精彩评论