本篇文章给大家带来的内容是关于tp5.1在view中使用函数 的方法(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
<?php
namespace app\test\controller;
use think\Controller;
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>相关推荐:
以上就是TP5.1在view中使用函数的方法(代码)的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号