Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
31
rated 0 times [  33] [ 2]  / answers: 1 / hits: 37731  / 10 Years ago, fri, march 14, 2014, 12:00:00

I have a theoretical question..



I know that you can get/read a PHP cookie with javascript by using: document.cookie



Is there a similar way to do this in PHP?



Can PHP get/read a cookie that is created i JavaScript?
If yes, then how can you do that?


More From » php

 Answers
14

You can use $_COOKIE, the superglobal. Just reference it like you would any array, where $_COOKIE['key_name'] is the cookie you want to access.



See the PHP API documentation.


[#72004] Wednesday, March 12, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yvettel

Total Points: 517
Total Questions: 101
Total Answers: 102

Location: Vanuatu
Member since Wed, Oct 14, 2020
4 Years ago
;