php - 如何在没有 $this 的情况下调用类内部的函数?

标签 php wordpress class

我想将表单挂接到外部函数上。钩子(Hook)按名称加载我的表单:

add_action(media_uploader, 'the_hook');
function the hook(){
//.....
return wp_iframe( 'media_upload_potato_form', $errors );
}
function media_upload_potato_form(){ }// my form

如果我在类中使用上述函数,如下所示,则会出现错误:

return wp_iframe($this->media_upload_potato_form, $errors);

如何正确连接?

最佳答案

使用

return wp_iframe(array('YourClassName', 'media_upload_potato_form'), $errors);

关于php - 如何在没有 $this 的情况下调用类内部的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10800924/

相关文章:

c# - 元组与类有何不同?

php - Zend Framework 中的引导模块特定样式/脚本

php - 我需要哪些不同的 Git 存储库?

wordpress - 我网站的 https 被划掉了

jquery - 无法让 Cycle2 轮播与文本叠加一起使用

C# 奇怪的对象行为

php - 使用 Paypal 注册

php - 哈希函数在ColdFusion 10+和PHP 7.x上的功能相同吗?

php - 显示 wordpress 页面的全部内容

c++ - 为什么不会创建此对象? C++