如何取消设置全局变量。 [英] How to unset global variables.

查看:122
本文介绍了如何取消设置全局变量。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目的 id 和一个客户端的 id ,这些客户端是php中的会话以JSON格式。这些存储在全局变量 id_p id_c 中,因此我可以使用这些ID进行多次插入和更新选择等。

I have an id of a project and an id of a client that are sessions in php that are passed in JSON format. These are stored in global variables id_p and id_c so I can do multiple inserts and updates selects etc. with those ids.

当用户选择另一个项目或更改页面时,我需要取消设置这些变量。

When the user selects another project or changes the page, I need to unset these variables.


  • 我可以将 null 中的 null 值传递给全局变量以重置它们吗?

  • 有没有更好的方法来做我想要的?

  • 我怎样才能在 php 上存储 php 值仅适用于文件是必须的?查询发生的文件位于不同的文件中。

  • Can I pass a null value from php to the global vars to reset them?
  • Is there a better way to do what I want?
  • How could I store the php values on php only if the file is required? The files where the queries take place are on separate files.

推荐答案

将它们设置为null或者未定义完成你要找的东西?

Would setting them to null or undefined accomplish what you're looking for?

id_p = null;
id_c = null;

这篇关于如何取消设置全局变量。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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