Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个辅助类,它有很多小函数可以帮助我创建我的内容,但是当我尝试将它包含在我的代码中时,PHP 显示一个错误,指出我的类不存在。我只是使用 require_once('../general.php'); 但它给了我一个“无法打开流”的错误。
只需将类添加到应用程序/类并正常使用即可。我使用了某种 Util.php 类和一些类似的静态函数。
哦,不要费心手动加载它,自动加载器应该可以很好地处理它。
编辑:确保您的课程以大写字母 (General.php) 开头,并在您的代码中将其称为 General。
您只需按名称调用它,如果您有Function.php 您可以通过 ( Function) 调用它,无需添加php扩展名。
Function.php
Function
php
General你不应该使用General.php
General
General.php