https://github.com/noname007/template_replace
变量替换
https://github.com/noname007/template_replace
php template-engine template-matching
Last synced: 3 months ago
JSON representation
变量替换
- Host: GitHub
- URL: https://github.com/noname007/template_replace
- Owner: noname007
- License: gpl-3.0
- Created: 2016-09-27T07:10:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-04T01:42:11.000Z (over 8 years ago)
- Last Synced: 2025-01-22T20:11:19.879Z (9 months ago)
- Topics: php, template-engine, template-matching
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 模板变量替换
[](https://travis-ci.org/noname007/template_replace)
## 简要说明
能识别的变量格式为(正则表达式描述):${\s*[0-9a-zA-Z._]+\s*}
变量样例如下:
${name}
${ name }
${ 1n12A }
具体的可以看 t.php 和 1.yml 中的使用。
## 用法样例:
- --template 必选; 模板,可以为任意文本文件
- --var 必选 ; 配置,格式固定,参考c.php
- --output 可选; 替换后的输出文件名> php convert.php --template 1.yml --var c.php
> php convert.php --template t.php --var c.php
> php convert.php --template t.php --var c.php --output output.php
当配置是json格式的的时候:(其实 convert_json.php 将json 转换成php 数组)
> php convert.php --template 1.yml --var config.json --type json
## 依赖:
window [下载 php](http://windows.php.net/download/)
linux 使用源或者自己编译安装。