在单击链接时销毁PHP会话 [英] Destroy a PHP session on clicking a link
本文介绍了在单击链接时销毁PHP会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此代码有效吗?
<a href="#" onclick="<?php session_destroy();?>">Logout</a>
推荐答案
否,它不是有效的代码.它将在加载php页面时破坏会话.
No it is not a valid code. It will destroy the session at the time of loading the php page.
要破坏点击时的会话,您应该写
For destroying session on click you should write
<a href="logout.php" >Logout</a>
在logout.php中
in logout.php
session_destroy();
这篇关于在单击链接时销毁PHP会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文