How can a cookie be accessed across multiple pages in PHP?
To access a cookie across multiple pages in PHP, you need to set the cookie with a path parameter that specifies the root path ("/"). This ensures that the cookie is accessible on all pages within the same domain. By setting the path parameter to "/", the cookie will be available across different directories and pages on the website.
// Set a cookie with a path parameter to make it accessible across multiple pages
setcookie("example_cookie", "cookie_value", time() + 3600, "/");