PHP setcookie "SameSite=Strict"?

The "SameSite=Strict" attribute is a security feature that can be added to a cookie when using the PHP setcookie() function. When set to "Strict", the cookie will only be sent with requests originating from the same site that set the cookie, and will not be sent with cross-site requests (such as those made by third-party sites). This helps prevent cross-site request forgery (CSRF) attacks. To set the "SameSite=Strict" attribute for a cookie, you would include it in the options array passed as the seventh argument to the setcookie() function.

Watch a course Learn object oriented PHP

Example:

setcookie('my_cookie', 'my_value', time() + 86400, '/', '', false, true, ['SameSite' => 'Strict']);

Please note that "SameSite" attribute is not supported in all browsers, you may need to check the browser support before using this.