我是靠谱客的博主 平淡微笑,这篇文章主要介绍THINKPHP5.1在view中使用函数,现在分享给大家,希望可以做个参考。

 

<?php
namespace apptestcontroller;
use thinkController;
class Index extends Controller
{
    public function index()
    {
        $this->assign('email','1047588430@qq.com');
        $this->assign('time',time());
        $this->assign('user','cjk');
        return $this->fetch();
    }
}

在view中使用{$变量名|函数}

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<h2>{$email} : {$email|md5}</h2>
	<h2>{$email} : {$email|md5|strtoupper}</h2>
	<h2>{$email} : {$email|substr=0,10}</h2>
</body>
</html>

 

最后

以上就是平淡微笑最近收集整理的关于THINKPHP5.1在view中使用函数的全部内容,更多相关THINKPHP5内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(126)

评论列表共有 0 条评论

立即
投稿
返回
顶部