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?
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!
PHP Cookies Checking if a Cookie is SetUse the isset() function upon the superglobal $_COOKIE variable to check if a cookie is set.
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[' ...
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.
Have you tried:
print_r($_COOKIE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With