iterator:php5中Iterator与smarty整合来源: 发布时间:星期四, 2009年2月12日 浏览:88次 评论:0
php5中Iterator和smarty整合 Iterator(迭代器)在PHP5中是非常重要 ![]() ![]() ![]() ![]() Smarty会自动将 ![]() ![]() ![]() ![]() ![]() ![]() ![]() 例如 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() <?php ![]() { protected $_data = ![]() public function rewind ![]() { re ![]() } public function current ![]() { ![]() } public function key ![]() { ![]() } public function next ![]() { ![]() } public function valid ![]() { ![]() ![]() ![]() } public function size ![]() { ![]() } } ?> 然后在Smarty使用这个类 {foreach from=$myClassObj item=row} {$row} {/foreach} 这样不会输出想要 ![]() ![]() ![]() ![]() ![]() ![]() {foreach from=$myClassObj->getData ![]() {$row} {/foreach} 这样就能输出正确 ![]() ![]() 0
相关文章读者评论发表评论 |