如何检查PHP中定义的常量? [英] How do I examine defined constants in PHP?

查看:109
本文介绍了如何检查PHP中定义的常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在NetBeans中使用Xdebug编写CodeIgniter的源代码,我正在寻找一种在定义的常量时查看定义的常量的方法。如果不可能,还有其他方法来显示所有定义的常量吗?

I'm stepping through the source code of CodeIgniter with Xdebug in NetBeans and I'm looking for a way to see defined constants as they are defined. If it's not possible, are there any other ways to display all defined constants?

推荐答案

看看 get_defined_constants 功能。它将返回代码中所有定义的常量的数组,直到函数调用。然后,您可以使用 print_r 打印出数组。

Take a look at the get_defined_constants function. It will return an array of all the defined constants in the code up to the point of the function call. You can then use print_r to print out the array.

这篇关于如何检查PHP中定义的常量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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