定制 wherd/signal 二次开发

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

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

wherd/signal

最新稳定版本:v1.0.0

Composer 安装命令:

composer require wherd/signal

包简介

Yet another template engine

README 文档

README

Yet another template engine.

Installation

Install using composer:

composer require wherd/signal

Introduction

Signal is yet another simple templating engine. All Signal templates are compiled into plain PHP code and cached, meaning Signal adds essentially zero overhead to your application. Signal template files use the .signal.php file extension.

Create a signal instance by passing it the folder(s) where your view files are located. Render a template by calling the render method.

use Signal\Compiler;
use Signal\View;

$compiler = new Compiler(__DIR__ . '/views');
$compiler->setCacheDirectory(__DIR__ . '/tmp');

$signal = new View($compiler);

echo $signal->render('homepage', ['name' => 'John Doe']);

Displaying Data

You may display data that is passed to your Signal views by wrapping the variable. For example, given the following:

use Signal\Compiler;
use Signal\View;

$compiler = new Compiler(__DIR__ . '/views');
$compiler->setCacheDirectory(__DIR__ . '/tmp');

$signal = new View($compiler);

echo $signal->render('homepage', ['name' => 'John Doe']);

You may display the contents of the name variable like so:

Hello, @{ $name }.

You are not limited to displaying the contents of the variables passed to the view. You may also echo the results of any PHP function. In fact, you can put any PHP code you wish inside of a Signal statement:

The current UNIX timestamp is @{ time() }}.

Displaying Unescaped Data

By default, Signal @{ } statements are automatically sent through PHP's htmlspecialchars function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:

Hello, @{! $name }.

// TODO

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固