我正在尝试做到这一点:
$productlist= $tpl->draw( 'products' );
稍后我想在其他文件上回显它:
而 $tpl->draw( 'products' ) 例如显示一些输出
<div id="productlist>
include("products");
</div>
尝试这个
$productlist= $tpl->draw( 'products' );
//类文件
class drawing{
function draw($type) {
$str='';
if($type=='')
$type='default'
$ids=$type.'list';
$str="<div id='$ids'> include('$type') </div>";
return $str;
}
}
您可以通过使用会话变量或从数据库或平面文件中存储和检索来将数据公开给另一个脚本。