Thinkphp5.1 uses Smarty template engine
Friends who are used to using smarty , if you don’t want to modify the existing template code, you can directly use composer to install the Smarty library, and modify the template configuration file to use the smarty template directly
think-smarty
ThinkPHP5.1Smarty engine driver
Installation Method
Use composer to install the template engine method: composer require emmetltd/think-smarty
ThinkPHP5.1 Configure the parameters in the template.php file
return [ // 模板引擎类型 支持 php think 支持扩展 'type' => 'Smarty', // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 'auto_rule' => 1, // 模板路径 'view_path' => '', // 模板后缀 'view_suffix' => 'html', // 模板文件名分隔符 'view_depr' => '_', //DIRECTORY_SEPARATOR, // 模板引擎普通标签开始标记 'tpl_begin' => '<{', // 模板引擎普通标签结束标记 'tpl_end' => '}>', // 标签库标签开始标记 'taglib_begin' => '{', // 标签库标签结束标记 'taglib_end' => '}', 'view_replace_str' => [ //字符替换部分 '/Upfiles/'=>'http://www.emmetltd.com/Uploads/', ], ];
Then the template index/view/index_index.html will be loaded when return view(); in the controller index/index::index
Recommended tutorial: "TP5》
The above is the detailed content of thinkphp5.1 uses Smarty template engine. For more information, please follow other related articles on the PHP Chinese website!

The article discusses ThinkPHP's built-in testing framework, highlighting its key features like unit and integration testing, and how it enhances application reliability through early bug detection and improved code quality.

Article discusses using ThinkPHP for real-time stock market data feeds, focusing on setup, data accuracy, optimization, and security measures.

The article discusses key considerations for using ThinkPHP in serverless architectures, focusing on performance optimization, stateless design, and security. It highlights benefits like cost efficiency and scalability, but also addresses challenges

The article discusses implementing service discovery and load balancing in ThinkPHP microservices, focusing on setup, best practices, integration methods, and recommended tools.[159 characters]

ThinkPHP's IoC container offers advanced features like lazy loading, contextual binding, and method injection for efficient dependency management in PHP apps.Character count: 159

The article discusses using ThinkPHP to build real-time collaboration tools, focusing on setup, WebSocket integration, and security best practices.

ThinkPHP benefits SaaS apps with its lightweight design, MVC architecture, and extensibility. It enhances scalability, speeds development, and improves security through various features.

The article outlines building a distributed task queue system using ThinkPHP and RabbitMQ, focusing on installation, configuration, task management, and scalability. Key issues include ensuring high availability, avoiding common pitfalls like imprope


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

Dreamweaver CS6
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Zend Studio 13.0.1
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools