duanli8391 2012-03-09 09:32
浏览 17
已采纳

如何在没有表单或Javascript的情况下触发logout.php脚本?

I want to have a button, that logs out the user on click. But I don't feel like creating a form for that, or making an "onclick" handler. Is there another way to do it?

<p class='loginposition normal'>
."$_SESSION['email']".<form action='/logout.php' method='post'><input class='logout-submit button' type='submit' style='float:right;' id='logoutbtn' value='Log Out'></form>
</p>";

I want them to be in one raw: user@user.com [Log Out]

  • 写回答

6条回答 默认 最新

  • dpc57092 2012-03-09 09:36
    关注

    If you want a POST request then you need either Ajax (which would be a silly technique to use for logging out) or a form.

    Since logging out is not a repeatable action, POST is the correct tool to do it.

    Get over your feelings and use a form.

    You can deal with the twin problems of your HTML being invalid and additional line breaks by putting the paragraph inside the form instead of the other way around.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?