futape/php-template 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

futape/php-template

Composer 安装命令:

composer require futape/php-template

包简介

A template engine for rendering PHP templates

README 文档

README

This library offers a template engine, which uses PHP files as templates.

Install

composer require futape/php-template

Usage

template.php

Hello <?php echo $name; ?>,

this is an usage example of futape/php-template.
Your installed PHP version is <?php echo PHP_VERSION; ?>.

Here's a list of all defined variables:

<?php
foreach (get_defined_vars() as $name => $value) {
    echo $name . ': ' . (string)$value . "\n";
}
?>

renderer.php

use Futape\PhpTemplate\Template;

$template = (new Template('template.php'))
    ->addVariable('name', 'Stranger');

echo $template->render();
/* Hello Stranger,

this is an usage example of futape/php-template.
Your installed PHP version is 7.2.0.

Here's a list of all defined variables:

name: Stranger
... */

The template file is executed in its own variable scope and has access to the defined variables only, as well as superglobals and variables made accessible via global.
Moreover it can access constants and can utilize any PHP functionality you an use in other PHP files as well.

Testing

The library is tested by unit tests using PHP Unit.

To execute the tests, install the composer dependencies (including the dev-dependencies), switch into the tests directory and run the following command:

../vendor/bin/phpunit

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固