出力バッファをスタックして、各バッファが独自のIDを持つようにする方法はありますか?PHPスコープ付き出力バッファー、どのように?
私はバッファを持つHTMLページを持っていますが、a hookに接続されたページコンテンツも持っています。フック自体も、出力バッファが含まれています
<?php ob_start(); ?>
<html>
<head></head>
<body>
<?php ob_start(); ?>
<?php echo $page->content; ?>
<?php echo ob_get_clean(); ?>
</body>
</html>
<?php ob_get_clean(); ?>
最初ob_get_clean()
は単なるHTMLページからの出力バッファを停止しました。
だから、このようなメカニズムがあるのでしょうか?各ob_get_clean()
が自分の価値を持つように
<?php ob_start('#template'); ?>
<html>
<head></head>
<body>
<?php ob_start('#page'); ?>
<?php echo $page->content; ?>
<?php echo ob_get_clean('#page'); ?>
</body>
</html>
<?php ob_get_clean('#template'); ?>
は:
:<p>Lorem ipsum dolor sit amet.</p>
#template
→<html> … </html>
#page
→は、私はこれらのエラーを得ました[28-May-2017 09:17:01 Asia/Jakarta] PHP Fatal error: Cannot destroy active lambda function in G:\server\www\lot\extend\plugin\lot\worker\block-e\index.php on line 5 [28-May-2017 09:17:01 Asia/Jakarta] PHP Stack trace: [28-May-2017 09:17:01 Asia/Jakarta] PHP 1. {main}() G:\server\www\index.php:0 [28-May-2017 09:17:01 Asia/Jakarta] PHP 2. require() G:\server\www\index.php:48 [28-May-2017 09:17:01 Asia/Jakarta] PHP 3. Hook::fire() G:\server\www\engine\fire.php:117 [28-May-2017 09:17:01 Asia/Jakarta] PHP 4. call_user_func_array:{G:\server\www\engine\kernel\hook.php:79}() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 5. do_fire() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 6. Route::fire() G:\server\www\engine\fire.php:113 [28-May-2017 09:17:01 Asia/Jakarta] PHP 7. call_user_func_array:{G:\server\www\engine\kernel\route.php:140}() G:\server\www\engine\kernel\route.php:140 [28-May-2017 09:17:01 Asia/Jakarta] PHP 8. {closure:G:\server\www\lot\extend\page\index.php:46-168}() G:\server\www\engine\kernel\route.php:140 [28-May-2017 09:17:01 Asia/Jakarta] PHP 9. Shield::attach() G:\server\www\lot\extend\page\index.php:166 [28-May-2017 09:17:01 Asia/Jakarta] PHP 10. ob_end_flush() G:\server\www\engine\kernel\shield.php:90 [28-May-2017 09:17:01 Asia/Jakarta] PHP 11. Shield::{closure:G:\server\www\engine\kernel\shield.php:84-88}() G:\server\www\engine\kernel\shield.php:90 [28-May-2017 09:17:01 Asia/Jakarta] PHP 12. Hook::NS() G:\server\www\engine\kernel\shield.php:86 [28-May-2017 09:17:01 Asia/Jakarta] PHP 13. call_user_func_array:{G:\server\www\engine\kernel\hook.php:94}() G:\server\www\engine\kernel\hook.php:94 [28-May-2017 09:17:01 Asia/Jakarta] PHP 14. Hook::fire() G:\server\www\engine\kernel\hook.php:94 [28-May-2017 09:17:01 Asia/Jakarta] PHP 15. call_user_func_array:{G:\server\www\engine\kernel\hook.php:79}() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 16. fn_twitter_cards_replace() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 17. Page->__get() G:\server\www\engine\kernel\hook.php:8 [28-May-2017 09:17:01 Asia/Jakarta] PHP 18. Hook::NS() G:\server\www\engine\kernel\page.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 19. call_user_func_array:{G:\server\www\engine\kernel\hook.php:94}() G:\server\www\engine\kernel\hook.php:94 [28-May-2017 09:17:01 Asia/Jakarta] PHP 20. Hook::fire() G:\server\www\engine\kernel\hook.php:94 [28-May-2017 09:17:01 Asia/Jakarta] PHP 21. call_user_func_array:{G:\server\www\engine\kernel\hook.php:79}() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 22. fn_image_set() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 23. Page->get() G:\server\www\lot\extend\plugin\lot\worker\image\index__.php:7 [28-May-2017 09:17:01 Asia/Jakarta] PHP 24. Page->content() G:\server\www\engine\kernel\page.php:170 [28-May-2017 09:17:01 Asia/Jakarta] PHP 25. Page->__call() G:\server\www\engine\kernel\page.php:170 [28-May-2017 09:17:01 Asia/Jakarta] PHP 26. Page->__get() G:\server\www\engine\kernel\page.php:42 [28-May-2017 09:17:01 Asia/Jakarta] PHP 27. Hook::NS() G:\server\www\engine\kernel\page.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 28. call_user_func_array:{G:\server\www\engine\kernel\hook.php:94}() G:\server\www\engine\kernel\hook.php:94 [28-May-2017 09:17:01 Asia/Jakarta] PHP 29. Hook::fire() G:\server\www\engine\kernel\hook.php:94 [28-May-2017 09:17:01 Asia/Jakarta] PHP 30. call_user_func_array:{G:\server\www\engine\kernel\hook.php:79}() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 31. fn_block_replace_e() G:\server\www\engine\kernel\hook.php:79 [28-May-2017 09:17:01 Asia/Jakarta] PHP 32. Block::replace() G:\server\www\lot\extend\plugin\lot\worker\block-e\index.php:9 [28-May-2017 09:17:01 Asia/Jakarta] PHP 33. preg_replace_callback() G:\server\www\lot\extend\block\engine\kernel\block.php:73 [28-May-2017 09:17:01 Asia/Jakarta] PHP 34. Block::{closure:G:\server\www\lot\extend\block\engine\kernel\block.php:69-73}() G:\server\www\lot\extend\block\engine\kernel\block.php:73 [28-May-2017 09:17:01 Asia/Jakarta] PHP 35. call_user_func_array:{G:\server\www\lot\extend\block\engine\kernel\block.php:72}() G:\server\www\lot\extend\block\engine\kernel\block.php:72 [28-May-2017 09:17:01 Asia/Jakarta] PHP 36. {closure:G:\server\www\lot\extend\plugin\lot\worker\block-e\index.php:4-9}() G:\server\www\lot\extend\block\engine\kernel\block.php:72 [28-May-2017 09:17:01 Asia/Jakarta] PHP 37. ob_start() G:\server\www\lot\extend\plugin\lot\worker\block-e\index.php:5
ありがとうございます。
私はこれを試してみることにします:http://php.net/manual/en/function.ob-get-level.php –