1

我开发的使用简码激活的 wordpress 插件破坏了我的管理区域,说无法修改标题。再深入一点我就知道,如果函数得到回显,那么如果我使用returnthan 就可以了。但是 return 的问题是:我使用 ajax 来检索 html,在这种情况下没有生成输出。

message Cannot modify header information - headers already sent by (output started at /var/www....    web/wordpress/wp-admin/admin-header.php


MyClass{

public function __construct()
         public $data;

    { 
                require_once(dirname(__FILE__) . '/class/class.another.php');
                $this->data = new Another(); 
        add_action( 'init', array( &$this, 'init' ) );      
    }



public function init()
    {
        add_shortcode( 'my_shortcode', array ($this, 'shortcode') );
                if(isset($_POST['id'])){

            $param = $this->data->output_ajax_html($_POST['id']);

            echo $this->shortcode_html_extended($param);
                        //this part breaks the buffer without echo is working   but the contertn won't show up      

        }       

    }

public function shortcode()
    {
        add_shortcode( 'my_shortcode', array ($this, 'shortcode_html') );   
    }

public function shortcode_html()
    {
        $html = "";
            $html .="";
            return $html;

    }

public function shortcode_html_extended($param)
    {
        $html = "";
            //mixed with php
            $html .="";
            return $html;
    }
} 

$test = new MyClass();
4

0 回答 0