首页 > 解决方案 > Wordpress:函数名必须是字符串

问题描述

我有一个 wordpress 插件,它会抛出错误“函数必须是字符串”。这是代码:

function make_fields() {
    global $post;
    $output = '';

foreach($this->fields as $field) {  
if(method_exists($this, $field['type'])) {
 $field = $this->clean_field_attributes($field);
$field_value = rvn_get_post_meta($post->ID, $field['id']);
        if(!empty($field_value))
 $field['value'] = $field_value;
field_output = $this->$field['type']($field);
if($field['type'] == 'group_start' || $field['type'] == 'group_end')
 $output.= $field_output;
else
  $output.= $this->output_wrapper($field, $field_output);
}
}

$output.='<input type="hidden" name="'.$this->box_data['id'].'_noncename" id="'.$this->box_data['id'].'_noncename" value="'.wp_create_nonce(plugin_basename(__FILE__)).'" />';  
echo $output;

似乎是问题的行是:

$field_output = $this->$field['type']($field);

有任何想法吗?

标签: phpwordpress

解决方案


推荐阅读