Home  >  Article  >  Backend Development  >  PHP原生模板引擎 最简单的模板引擎_php模板

PHP原生模板引擎 最简单的模板引擎_php模板

WBOY
WBOYOriginal
2016-05-17 09:11:311220browse
复制代码 代码如下:

$a = array(
'a','b','c'
);
require 'template/demo.php';//引用模板
?>

模板文件:
复制代码 代码如下:





模板测试


=$a[1]?>
 <br><?php print_r($a); ?> <br><pre class="brush:php;toolbar:false"> <br> <br> <br>

复制代码 代码如下:


键值: =$value?>


//数组的迭代
//smarty:
{foreach item=na from=$a key=key}
键值:{$key}

{/foreach}
//对于PHP程序员那个更好理解呢?
//smarty 解析模板还用到正则,PHP的正则效率不会高到哪里去吧...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn