Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我如何才能从中获取内容?>;以及<;?php_Php_Oop_Xhtml - Fatal编程技术网

我如何才能从中获取内容?>;以及<;?php

我如何才能从中获取内容?>;以及<;?php,php,oop,xhtml,Php,Oop,Xhtml,这只是一个个人学习的问题。我想检索我的函数$page->content_start()之间的所有内容;和$page->content_end();最好的办法是什么?我不想包括它或附和它,有可能吗 非常感谢,非常感谢您的建议 <?php include 'pages/indexpage.class.php'; include 'modules/monmodule.class.php'; $page = new IndexPage(); $mod = new MonModule($pag

这只是一个个人学习的问题。我想检索我的函数$page->content_start()之间的所有内容;和$page->content_end();最好的办法是什么?我不想包括它或附和它,有可能吗

非常感谢,非常感谢您的建议

<?php 

include 'pages/indexpage.class.php';
include 'modules/monmodule.class.php';

$page = new IndexPage();
$mod = new MonModule($page);
$mod->create();

$page->content_start();
?>
<div class="asss_ass"></div>
<span></span>
<?php
$page->content_end();
print_r($page->get_content());
?>

使用:

ob_start();
?>

你想“找回”它是什么意思?你想做什么?“个人学习问题”如果你问我们,你不是在学习,只是说:-)^没错。你想得到课堂助理的内容还是跨度中的内容?我想向你学习,因为我被封锁了。。。检索我的意思是获取所有内容您正在生成内容,为什么要再次检索它?
ob_start()
需要在PHP块中:Pi尝试了它,但我想将所有内容放在我的$page->get_content()中,用它创建整个页面。你也可以使用
ob_get_clean
:-)@Rocket:我不知道,更改了@迈克:你可以随心所欲地使用
$content
,一切都在这个变量中。就是这样!火箭队你赢了泰和杰伦^^
ob_start();
?>
<div class="asss_ass"></div>
<span></span>
<?php
$content = ob_get_clean();