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

查看:25
本文介绍了如何检查 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天全站免登陆