PHP setcookie for 1 Year will not work

后端 未结 5 1141
慢半拍i
慢半拍i 2021-01-07 22:32

I\'m trying to set a PHP cookie to expire 1 Year from when the user logged in, and I\'m doing it this way:

setcookie(\"myCookie\",\'exampleUserName\',(365 *          


        
5条回答
  •  悲哀的现实
    2021-01-07 23:22

    Try this:

    
    
    >> Here 'TestName' is name of cookie.
    >> "Test Value" is value to store.
    >> time()+3600 * 24 * 365 - will set cookie time till 1 year.
    

    Thanks!

提交回复
热议问题