Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I display all the cookies I set in PHP?

I am trying to diagnose an error in my cookies, but the names of the cookies are not what they should be. Is there a way in PHP to print all the cookies that have been set by my domain?

like image 405
James Avatar asked Mar 06 '12 02:03

James


People also ask

How can I see all cookies in PHP?

You can use the print_r or var_dump function to check all available cookies for debugging purposes. print_r( $_COOKIE ); It's that easy to read cookies in PHP!

How do you check if cookies are set PHP?

PHP Cookies Checking if a Cookie is SetUse the isset() function upon the superglobal $_COOKIE variable to check if a cookie is set.

How can I store multiple cookies in PHP?

php $row = array( 'User_ID' => '1', 'UserName' => '1', 'Access_Level' => '1', 'Db_Con' => '1' ); setcookie('user_id', $row['User_ID'], time()+ (60*15),"/"); setcookie('user_name', $row['UserName'], time()+ (60*15),"/"); setcookie('access_Level', $row['Access_Level'], time()+ (60*15),"/"); setcookie('db_con', $row[' ...

Can PHP set cookies?

With PHP, you can both create and retrieve cookie values. The name of the cookie is automatically assigned to a variable of the same name. For example, if a cookie was sent with the name "user", a variable is automatically created called $user, containing the cookie value.


1 Answers

Have you tried:

print_r($_COOKIE) 
like image 155
imm Avatar answered Sep 23 '22 05:09

imm