Hi, Ralph, My problem is gone. I made a mistake: I retrieved session in view, so failed. But I have another question: Where shall put sentences: require_once 'Zend/Session.php'; Zend_Session::start(); I put them in bootstrap, but failed. Then I put it in init() of controller, it worked. So is init() of controller the only place that I shall put the two sentences?
Best regards, minglee Ralph Schindler wrote: > > I have just tested your code (in two scripts) and it seemingly works fine. > > $ cat test_session1.php > <? > > require_once 'Zend/Session/Namespace.php'; > $authNamespace = new Zend_Session_Namespace('Zend_Auth'); > $authNamespace->user = "myusername"; > > ?> > > Username set. > $ cat test_session2.php > <? > > require_once 'Zend/Session/Namespace.php'; > $authNamespace = new Zend_Session_Namespace('Zend_Auth'); > > ?> > > Username is: <?= $authNamespace->user; ?> > > > > I request session1 file, then request session2 file and i get back the > username set in session1 file. > > Troubleshooting: do you have error's being suppressed by php (or are > redirected to the error_log? Perhaps the default /tmp location is not > writable? Are you sure you are working in an environment (valid > hostname) that can set cookies on your client (browser?) > > These are a few of the outside factors that might affect your ability to > be able to use ext/session in general. > > -ralph > > > > minglee wrote: >> >> >> Darby Felton wrote: >>> Hello, >>> Hi, Darby, >>> My error, I did what you suggest, but failed. >>> Try: >>> >>> require_once 'Zend/Session/Namespace.php'; >>> $authNamespace = new Zend_Session_Namespace('Zend_Auth'); >>> echo $authNamespace->user; >>> >>> Best regards, >>> Darby >>> >>> minglee wrote: >>>> Hi, >>>> I have session problem, which may be stupid: >>>> I set a session: >>>> require_once 'Zend/Session/Namespace.php'; >>>> $authNamespace = new Zend_Session_Namespace('Zend_Auth'); >>>> $authNamespace->user = "myusername"; >>>> How can I retrieve it from ANOTHER page? >>>> I used "echo $authNamespace->user;" but failed! >>>> Anybody can answer? >>>> Regards >>> >> > > > -- View this message in context: http://www.nabble.com/Session-problem-tf4199306s16154.html#a11957009 Sent from the Zend Framework mailing list archive at Nabble.com.