第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何讓ob_start()在Wordpress插件中的類中工作?

如何讓ob_start()在Wordpress插件中的類中工作?

PHP
元芳怎么了 2021-05-07 14:08:35
我試圖將ob_start添加到我的Wordpress插件中的類中,如下所示:class ObStart {  public static function callback($buffer){    return $buffer;  }  public static function add_ob_start(){    ob_start("callback");  }  public static function flush_ob_end(){    ob_end_flush();  }}add_action('init', array( 'ObStart', 'add_ob_start' ) );add_action('wp_footer', array( 'ObStart', 'flush_ob_end' ) );這似乎不起作用,而是導(dǎo)致此錯(cuò)誤:Warning:  ob_start(): function 'callback' not found or invalid function name in <b>\wp-content\plugins\timeline-plugin\obstart.php on line 8Notice:  ob_start(): failed to create buffer in \wp-content\plugins\timeline-plugin\obstart.php on line 8Warning:  Cannot modify header information - headers already sent by (output started at \wp-includes\formatting.php:5520) in \wp-includes\pluggable.php on line 1251Warning:  Cannot modify header information - headers already sent by (output started at \wp-includes\formatting.php:5520) in \wp-includes\pluggable.php</b> on line 1254是否可以讓ob_start在課堂上工作?如果是,我哪里出問題了?
查看完整描述

1 回答

?
ABOUTYOU

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

class Obstart 

      public static function callback($buffer)

      { 

           return $buffer; 

      } 


      public static function add_ob_start()

      { 

           global $buffer; 


           ob_start( self::callback($buffer) ); 

      }


      public static function flush_ob_end()

      { 

           ob_end_flush(); 

      } 


add_action('init', array( 'Obstart', 'add_ob_start' ) ); 

add_action('wp_footer', array( 'Obstart', 'flush_ob_end' ) );


查看完整回答
反對(duì) 回復(fù) 2021-05-28
  • 1 回答
  • 0 關(guān)注
  • 185 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)