require_once问题

发布于 2024-09-09 06:57:58 字数 679 浏览 1 评论 0原文

我在 __constructor 中有这段代码

  $this->Reliability = new Reliability("name","url");

问题:我遇到了一个意外的奇怪错误:

Fatal error: Class 'Reliability' not found in "/path/"

我正在使用“__autoload”方法来调用所需的类,但当我在 ModalBOX 窗口。如果我请求 ModalBox 之外的文件,一切都会顺利:(

有一些技巧来修复它吗?

提前非常感谢!

PS

这是 __autoload 方法:

function __autoload($className) { 
  if (file_exists($className . '.php')) {   
      require_once $className . '.php'; 
      return true; 
  }

否则返回 false; }

I have this code in the __constructor

  $this->Reliability = new Reliability("name","url");

Problem: I got an unexpected strange error:

Fatal error: Class 'Reliability' not found in "/path/"

I'm using the "__autoload" method to call the required classes, but it doesn't work when I'm calling the file in a ModalBOX Window. If I request the file outside the ModalBox evrything goes fine :(

Some tricks to fix it?

thank you very much in advance!

P.S.

this is the __autoload method:

function __autoload($className) { 
  if (file_exists($className . '.php')) {   
      require_once $className . '.php'; 
      return true; 
  }

else return false;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你穿错了嫁妆 2024-09-16 06:57:58

您的自动加载器是否已在模态框中显示的文件中注册?

Is your autoloader registered in the file displayed in the modalbox?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文