0
PHP中是否可以將HTML代碼的輸出抓取到變量中?基本上,我在尋找此代碼的縮寫:將html輸出打包到變量中
<?php ob_start(); ?>
<div class="headSection">
<h1><?=$headline?></h1>
<p><?=$bottomline?></p>
</div>
<?php $contents = ob_get_contents(); ob_end_clean(); ?>
我想要的HTML代碼保存在$contents
變量。
沒有我的回答爲你工作? – Alex
@ w0rldart對不起,對不起:) –