PHP setcookie “SameSite=Strict”?

后端 未结 9 2149
旧时难觅i
旧时难觅i 2020-11-29 00:26

I recently read \"RFC 6265\" on the attribute \"Same Site\", I looked at some articles that talked about that in April 2016, \"same-site\" attribute has been implemented for

9条回答
  •  独厮守ぢ
    2020-11-29 01:01

    I wrote a class for setting samesite cookies.

    https://github.com/ovunctukenmez/SameSiteCookieSetter

    It works on all PHP versions. It also checks if the browser supports samesite parameter properly.

    Here is the usage:

    //set samesite strict php cookie
    SameSiteCookieSetter::setcookie('samesite_test','testvalue', array('samesite' => 'Strict'));
    

提交回复
热议问题