不去做怎么知道做不到,用心做好每一天做好每一件|

轻风细雨_林木木

园龄:6年3个月粉丝:4关注:1

Think PHP 学习笔记 15.模板变量的详解

1.标量的输出

//模块
$arr = array('k1'=>'小赵1','k2'=>小赵2);
$this->assign('name',$arr);
$this->display();
//模板
{$name.k1}
{$name[k1]}

2.对象的输出

//模块
//对象的输出
//1. 建立一个My文件夹 位置'ThinkPHP/Extend/Library/ORG'
//2. 在My里,建立文件'Test.class.php'
class Test{
public $k = '定义的对象!!';
}
//3.
import('ORG.My.Test');
$obj=new Test;
$this->assign('name',$obj);
$this->display();
//模块
{$name:k}

系统变量

//模板
{$Think.get.na}
{$Think.const}

加密

//模板
{$number|md5}

时间戳

//模块
$this->assgin('name',time());
$this->display();
//模板
// data [时间的格式] [### 现在的时间]
{$name|date='Y-m-d H:i:s',###}

运算符

//模块
$this->assign('nub',12);
$this->display();
//模板
{$nub + 5}

本文作者:轻风细雨_林木木

本文链接:https://www.cnblogs.com/linzhifen5/p/16961527.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   轻风细雨_林木木  阅读(65)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 尚好的青春 孙燕姿
  2. 2 孙燕姿
  3. 3 克卜勒 孙燕姿
- 孙燕姿
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.