这篇文章主要介绍了ThinkPHP在Cli模式下使用模板引擎的方法,实例分析了ThinkPHP基于Cli模式操作模板的技巧,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例讲述了ThinkPHP在Cli模式下使用模板引擎的方法。分享给大家供大家参考。具体如下:
关于Cli模式与模版引擎,2.1中的手册是这样说明的:
Cli模式默认不使用任何模板引擎(可以自己在操作方法里面调用);
但是怎么调用,,手册中没有提到。于是自己动手丰衣足食。
在介绍怎么调用之前,简单的说说什么情况可能需要用到模块引擎:
1. 利用dompdf在计划任务自动生成PDF或HTML报告
2. 计划任务发送HTML类型的邮件
3. 后台自动生成静态页面
4. 其他关于模板的后台操作
view = Think::instance('View'); $this->view->assign('rows', array(array('title'=>'test',))); $this->view->assign('title', 'This is a title'); $content = $this->view->fetch('Index/index.html'); var_dump($content); } } ?>
希望本文所述对大家基于ThinkPHP框架的php程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.