如何用一个按钮销毁php会话

问题描述:

我想制作一个简单的表单按钮,当你点击它时会完全破坏会话。我刚开始第一次使用PHP,并没有看到我如何将它实现到我的HTML代码中。

I'd like to make a simple form button which completely destroys the session when you click on it. I am just starting to use PHP for the first time, and do not see how I implement it into my HTML code.

我想要的只是一个表单按钮这将清除会话(并可能解释它是如何工作的)。

What I'd like is simply a form button which will clear the session (and possibly an explanation as to how it works)

表单按钮就像任何其他表单按钮,没什么特别的。抓住事物的php方面的POST,并使用session_destroy();完全杀死会话数据。

The form button is just like any other form button, nothing special. Catch the POST on the php side of things, and use session_destroy(); to kill the session data entirely.

有关表单和帖子的信息,请参阅本指南: http://www.tizag.com/phpT/postget.php http://www.tizag.com/phpT/phpsessions.php 有关会话的信息

See this guide for info about forms and post if you're hazy on the subject: http://www.tizag.com/phpT/postget.php and this http://www.tizag.com/phpT/phpsessions.php for info about sessions

有关表单和PHP的更多信息以及如何使用表单中的数据: http:/ /www.tizag.com/phpT/forms.php

More info about forms and PHP and how to work with the data from the form: http://www.tizag.com/phpT/forms.php

示例:

顺序。 html:

Order.html:

<html><body>
<h4>Tizag Art Supply Order Form</h4>
<form action="process.php" method="post">
<input type="submit" />
</form>
</body></html>

process.php:

process.php:

<html><body>
<?php
session_destroy();
?>
</body></html>

这很俗气......这有帮助吗?

It's cheesy...does this help?