Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creating Cookie in cakephp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 487
    Comment on it

    Hello Readers this is small blog on creating cookie in your cakephp application. Cookies are a mechanism for storing data in the web  browser and helps in  identifying  users.

    Cookies are files that contain information about the user identification like name age etc. These files are stored on the users computer and they are used for tracking users. Whenever the computer send a request to the browser for the same page the , it will send the cookie too, then server use this information to identify the user .

     

    For creating cookie in your cakephp application you need to follow some steps written below:

     

        1. First set Cookie on components variable in  your AppController

    var $components = array('Cookie');

     

        2. Next, In any function in your UsersController page, you can write

    $this->Cookie->write('anyname', cookieData, $encrypt = false, $expires = null);

     

        3. Now, To read the stored cookie, write the following code in the view file or in any function.

    $this->Cookie->read('anyname');

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: