怎么在Widget的Class中取得beginWidget到endWidget之间的body content的内容?

<?php $this->beginWidget(‘ext.xyz.XyzClass’, array(

'property1'=&gt;'value1',


'property2'=&gt;'value2')); ?&gt;

…body content of the widget…

<?php $this->endWidget(); ?>

请问在XyzClass怎么拿到中间body content内容?

你可以直接用$this->Widget,然后把中间的部分传给这个Widget就可以了

我看了下源码,不知道 在 init() 里 用 ob_start ,在 run() 里ob_get_contents()捕获输出 可行否

已经解决了,谢谢楼上的解答。

我把代码进行了截取处理,生成各自widget的view文件,就不直接从widget中获取了。