如何展示thinkPHP控制器中的变量在模板里的具体实现示例?

更新于
2026-09-23 02:53:44
0阅读来源:SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计614个文字,预计阅读时间需要3分钟。

如何展示thinkPHP控制器中的变量在模板里的具体实现示例?

本例讲述了ThinkPHP控制器的变量在模板中的显示方法。以下是一个简单的示例:

php控制器中变量定义:public function register(){ $type=I('param.type'); // 1. 学生注册 2. 教师注册 3. 其他注册}

在模板中显示变量:{$type}

本文实例讲述了thinkPHP控制器变量在模板中的显示方法。分享给大家供大家参考,具体如下:

控制器中变量

public function register() { $type = I("param.type");//1.学生注册 2.教师注册 3.其他注册 $this -> assign("type", $type); //q全部部门 $depart1 = M("Depart") -> where("status=1 and fid=0") -> order("id asc") -> select(); $this -> assign("depart1", $depart1); $this -> display(); }

模板中引用位置一:php代码中,直接用$i;

<php> echo $i; </php

模板中引用位置二:模板中直接应用{$i}或者 class="{$unlogined}"

<font color="red">注意:1.非相关人员,严禁注册。

阅读全文
标签:显示方法

本文共计614个文字,预计阅读时间需要3分钟。

如何展示thinkPHP控制器中的变量在模板里的具体实现示例?

本例讲述了ThinkPHP控制器的变量在模板中的显示方法。以下是一个简单的示例:

php控制器中变量定义:public function register(){ $type=I('param.type'); // 1. 学生注册 2. 教师注册 3. 其他注册}

在模板中显示变量:{$type}

本文实例讲述了thinkPHP控制器变量在模板中的显示方法。分享给大家供大家参考,具体如下:

控制器中变量

public function register() { $type = I("param.type");//1.学生注册 2.教师注册 3.其他注册 $this -> assign("type", $type); //q全部部门 $depart1 = M("Depart") -> where("status=1 and fid=0") -> order("id asc") -> select(); $this -> assign("depart1", $depart1); $this -> display(); }

模板中引用位置一:php代码中,直接用$i;

<php> echo $i; </php

模板中引用位置二:模板中直接应用{$i}或者 class="{$unlogined}"

<font color="red">注意:1.非相关人员,严禁注册。

阅读全文
标签:显示方法