wordpress如何在类中调用函数

时间:2018-03-10 16:12:10

标签: wordpress

wp-content / plugins / yith / closs.yith.php 具有以下代码:

if(!class_exists('YITH_WooCommerce_Question_Answer')){     class YITH_WooCommerce_Question_Answer {     function love(){                 echo“kkkk”;
            }     }     }

如何在其他页面的类中调用love()函数? 我尝试在 wp-content / themes / xtocky / woocommerce / content-product.php 中编写以下代码:

$som_var = new YITH_WooCommerce_Question_Answer();
$som_var->love();

但没有工作......

然后我尝试了:

YITH_WooCommerce_Question_Answer::love();

它也不起作用。

0 个答案:

没有答案