如何用一个按钮销毁php会话 [英] How to destroy the php session with one button

查看:125
本文介绍了如何用一个按钮销毁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?

这篇关于如何用一个按钮销毁php会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆