1 Star 0 Fork 1

董楠 / PHPView

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

PHPView

PHPView 是以PHP作为模板引擎的View工具类。

环境要求

  • PHP >= 5.3

安装

composer 安装

PHPView 可以通过 composer 安装,使用以下命令从 composer 下载安装 PHPView。

$ composer require dongnan/phpview

手动下载安装

下载地址

安装方法

在你的入口文件中引入

<?php 
	//引入 PHPView 的自动加载文件
	include("path_to_linkcache/autoload.php");

如何使用

PHP代码:(假如模板文件的路径为 view\template.html)

<?php
require_once __DIR__ . '/vendor/autoload.php';

$view = new \PHPView\View();

//模板变量赋值
$view->assign('name','Dong Nan');

//数组赋值
$view->assign(array('gender'=>'male' 'birthday'=>'1986'));

//输出页面内容
$view->render('view\template.html');

模板:

<html>
	<head>
		<meta charset='utf-8'>
	</head>
	<body>
		<div>name:<?=$name?></div>
		<div>gender:<?=$gender?></div>
		<div>birthday:<?=$birthday?></div>
	</body>
</html>

LICENSE

使用非常灵活宽松的 New BSD License 协议

Copyright (c) 2016, 董楠 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the {organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

PHP视图类 展开 收起
PHP
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/dongnan/PHPView.git
git@gitee.com:dongnan/PHPView.git
dongnan
PHPView
PHPView
master

搜索帮助