从wordpress functions.PHP调用PHP类中的方法
我有一个单独的PHP类,名为MyClass.PHP。我需要在那个类中调用一个方法并给它发送一个变量。这是我在functions.php中的内容:从wordpress functions.PHP调用PHP类中的方法,php,wordpress,Php,Wordpress,我有一个单独的PHP类,名为MyClass.PHP。我需要在那个类中调用一个方法并给它发送一个变量。这是我在functions.php中的内容: function email_submission($entry, $form){ MyClass::addEmail($entry["2"]); } //Fatal error: Class 'MyClass' not found in /path/wp-content/themes/mytheme/functions.php 我遗漏了什
function email_submission($entry, $form){
MyClass::addEmail($entry["2"]);
}
//Fatal error: Class 'MyClass' not found in /path/wp-content/themes/mytheme/functions.php
我遗漏了什么?尝试添加这一行
require_once'MyClass.php'代码>您是否尝试将您的类文件包含在require
或include
中?