简体   繁体   English

需要或包含PHP类:无法访问函数

[英]Require or Include PHP class : can't access functions

I am working on a Wordpress-based site. 我正在基于Wordpress的网站上工作。 I'm trying to include a PHP class, and seem to have success, though I can't use the functions within the class (functions are not recognized). 我正在尝试包括一个PHP类,并且似乎取得了成功,尽管我无法在该类中使用函数(无法识别函数)。

Note: I'm including the class inline via a custom template page within my WP theme. 注意:我通过WP主题中的自定义模板页面将类内联。

Try to instantiate the class first, then access the function through your variable 尝试先实例化该类,然后通过变量访问该函数

$a = new Class();
$a->function();

But some functions are private, read the documentation of the class first.. 但是某些功能是私有的,请先阅读该类的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM