检查函数是否已经被调用 [英] Check if function has been called yet

查看:56
本文介绍了检查函数是否已经被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP OOP的新功能

我的一个功能需要另一个功能才能运行.有什么方法可以检查吗?

One of my functions requires another function to be executed before running. Is there a way I can check this?

推荐答案

与语言无关的答案:

保留(静态或全局)状态"变量,并在调用前提条件函数时设置一个标志.检查相关函数中的标志,以决定是否允许其运行.

Keep a (static or global) "state" variable and set a flag within the prerequisite function when it's called. Check the flag in the dependent function to decide whether it's allowed to run.

这篇关于检查函数是否已经被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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