💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### foreach循环 ~~~ /** * 模版标签例子 * 视图文件位置: /application/example/view/ViewController/foreachExample.html * @return string */ public function foreachExample() { $user = [ [ 'name' => 'lily', 'age' => 18, ], [ 'name' => 'tom', 'age' => 19, ], ]; $this->assign('user', $user); return $this->fetch(); } ~~~ ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>fetch</title> </head> <body> <h2>I am __ROOT__/application/example/view/ViewExample/foreachExample.html</h2> <table border="1"> <foreach name='user' item='v'> <tr> <th>名字</th> <th>年龄</th> </tr> <tr> <td>{$v['name']}</td> <td>{$v['age']}</td> </tr> </foreach> </table> </body> </html> ~~~