查找类实例化的位置 [英] Find where a class was instantiated
问题描述
我试图解决错误:致命错误:无法重新命名类
我不能找到类实例化的位置。
I have been looking everywhere and I can't find where the class was instantiated.
有没有我可以打印该类的现有实例的调试信息。
Is there anyway I can print debug info about the existing instance of that class.
推荐答案
您正在导入多次声明类的文件。这可能是包含/需要失去控制的症状,所以您可能需要简单的结构。
Chances are you are importing the file that declares the class more than once. This can be symptomatic of includes/requires getting out of control so you may need to simply your structure.
一种替代方法是使用自动加载来加载类,以避免这种的问题。另一个是只使用include_once或require_once。我通常喜欢使用require具有简单的结构。
One alternative approach is to use autoload to load classes to avoid this kind of problem. Another is to only use include_once or require_once. I generally prefer to use require with a simple structure.
这篇关于查找类实例化的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!