zendframework_php tutorial on using zendsession in the Zend Framework 2

Source: Internet
Author: User
Tags zend framework

About the use of zend\session in the Zend Framework 2, Zendframework


has been puzzled by the use of zend\session, this is the official zend\session of the Chinese version of the tutorial, http://zend-framework-2.yangfan.co/blog/556.

One of the most important is the use of the Zend\session\container class, which is the most important. Container is a container for storing information.

Instantiation of the container,

Use Zend\session\container;

$container = new Container (' namespace ');

$container->item = ' foo ';

Take out an instance of container and instantiate the container with the same name.

$container = new Container ("namespace");

Echo $container->item;

The value is taken out.


Teach a Zend framework to use session problems

Zend does not seem to open it, I was just beginning to see, many do not understand $user = new Zend_session_namespace (' user ');
$user->name = $modelUser->username;
$user->setexpirationseconds (3600);
This is stored directly in the session, for informational purposes only,

How to use Zend Framework to realize user registration and login?

User registration or login should have the corresponding UserInfo information table, the database can read it
As for the question you asked, I think it's how it should be. Retention of information after login
This can be used to save the login session to create a session at any time to read the login information

http://www.bkjia.com/PHPjc/888531.html www.bkjia.com true http://www.bkjia.com/PHPjc/888531.html techarticle with regard to the use of zend\session in the Zend Framework 2, Zendframework has been puzzled by the use of zend\session, which is the Chinese version of the official Zend\session tutorial, HTTP// Zend-framework-2.ya ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.