For the moment to retrieve a session stored variable you use something like
this :
1. $defaultNamespace = new Zend_Session_Namespace('Default');
2.
3. if (isset <http://www.php.net/isset>($defaultNamespace->
numberOfPageRequests)) {
4. // this will increment for each page load.
5. $defaultNamespace->numberOfPageRequests++;
6. } else {
7. $defaultNamespace->numberOfPageRequests = 1; // first time
8. }
9.
10. echo <http://www.php.net/echo> "Page requests this session: ",
11. $defaultNamespace->numberOfPageRequests;
Maybe it be more convenient to provide additional accessor, something like
$myDefaultLang = new Zend_Session_Namespace('Userpref', '
SessionVO::defaultLanguageCode');
to retrive the $_SESSION['Userpref']['SessionVO::defaultLanguageCode']
The idea it be to store the session variables names as class constants(for
some who like this, to avoid spelling errors) and to retrieve directly the
variable.
Best regards
Alex Petroni
没有评论:
发表评论