使用 ThinkPHP 在 controller 抓到資料
public function product() { $oProductList = Product::select(); $this->view->assign('oProductList', $oProductList); return $this->view->fetch(); }
後 想套用在 HTML 使用 forloop
{volist name="oProductList" id="oProduct" key="key"}
{$oProduct.id} - {$key}<br/>
{/volist}
<!--
輸出:
1 - 1
2 - 2
3 - 3
4 - 4
-->
文章標籤
全站熱搜
