定制 azettl/php-nano-template 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

azettl/php-nano-template

Composer 安装命令:

composer require azettl/php-nano-template

包简介

The php-nano-template class replaces placeholders in a string with values from an array.

README 文档

README

Codacy Badge

The php-nano-template class replaces placeholders in a string with values from an array.

Installation

composer require azettl/php-nano-template

Usage

$nano = new com\azettl\nano\template();
$nano->setTemplate(
  "<p>
    {user.greeting()} {user.function(2)} {user.function('test')} {user.first_name} {user.last name}! 
    Your account is <strong>{user.account.status}</strong> 
    {user.nonexistingnode}
  </p>"
);
$nano->setData($aData);
$nano->setShowEmpty(true);

echo $nano->render(); 

or

$nano = new com\azettl\nano\template(
  "<p>
    {user.greeting()} {user.first_name} {user.last name}! 
    Your account is <strong>{user.account.status}</strong> 
    {user.nonexistingnode}
  </p>",
  [
    "user" => [
      "login" => "demo",
      "first_name" => "Anon",
      "last name" => "Ymous",
      "account" => [
        "status" => "active",
        "expires_at" => "2016-12-31"
      ],
      "greeting" => function(){
        return 'Hello';
      },
      "function" => function($param){
        return 'Test' . $param;
      }
    ]
  ]
);

echo $nano->render(); 

or

$nano = new com\azettl\nano\template();
$nano->setTemplateFile(
  "tests/template.html"
);
$nano->setData($aData);

echo $nano->render(); 

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固