How can you delete a cookie in PHP?
To delete a cookie in PHP, you can set the cookie's expiration time to a past time. This will effectively remove the cookie from the user's browser.
// Set the cookie's expiration time to a past time
setcookie("cookie_name", "", time() - 3600, "/");
Related Questions
- Are there any specific best practices to follow when reading input from a socket in PHP?
- How can the provided PHP function "url_entfernen" be integrated into a WordPress template to restrict hyperlinks in a contact form?
- What are the recommended approaches for structuring and organizing PHP code to improve readability and maintainability when working with complex database operations?