Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to set the time for session cache expire in php

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 897
    Comment on it

    Here we will learn with the help of an example that how we can set the time for session cache expire in php. We use a function session_cache_expire() which returns the current setting of session.cache_expire.


    Example

    <?php
    
    /*Here we are setting the cache limiter  to  'private'  */
    
    session_cache_limiter('private');
    $cache_limiter =  session_cache_limiter();
    
    /* Here we are setting the  cache expire  to 25  minutes  */
    session_cache_expire(25);
    $cache_expire = session_cache_expire();
    
    /* Now we start the session */
    
    session_start();
    
    echo "The cached session pages will expire after the set time i.e. 25 minutes  ";
    ?>
    

    The default time is 180 minutes.

 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: