Creating javascript function to destroy php session

后端 未结 4 1428
鱼传尺愫
鱼传尺愫 2021-01-15 03:09

I am having trouble figuring out how to create a javascript function that will destroy a php session. I have a clickable link that will call a function called destroyphpses

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 03:36

    A PHP session generally uses a cookie that is stored client side. The following code will clear that cookie thus unlinking the session.

    document.cookie = 'PHPSESSID=; expires=Thu, 01-Jan-70 00:00:01 GMT;';

提交回复
热议问题