Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从wordpress functions.PHP调用PHP类中的方法_Php_Wordpress - Fatal编程技术网

从wordpress functions.PHP调用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 我遗漏了什

我有一个单独的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

我遗漏了什么?

尝试添加这一行
require_once'MyClass.php'

您是否尝试将您的类文件包含在
require
include
中?