如何查看另一个php文件中定义的变量? [英] How can I see a variable defined in another php-file?

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

问题描述

我在所有的php文件中使用相同的常量。我不想在我的所有文件中分配此变量的值。所以,我想创建一个parameters.php文件并在那里进行分配。然后在所有其他文件中我包含parameters.php并使用parameters.php中定义的变量。

I use the same constant in all my php files. I do not want to assign the value of this variable in all my files. So, I wanted to create one "parameters.php" file and to do the assignment there. Then in all other files I include the "parameters.php" and use variables defined in the "parameters.php".

这是想法,但它不起作用。我还试图使变量 global 。它也行不通。有办法做我想要的吗?或者可能有一些替代方法?

It was the idea but it does not work. I also tried to make the variable global. It also does not work. Is there a way to do what I want? Or may be there some alternative approach?

推荐答案

这正是它的工作原理。

您是否设置了错误报告,错误日志中是否有任何内容?我猜测包含失败,但你没有看到错误。

Have you got error reporting set up, and is there anything in the error log? I'm guessing the include is failing but you're not seeing the error.

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

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