Home >Backend Development >PHP Tutorial >PHP native template engine The simplest template engine

PHP native template engine The simplest template engine

高洛峰
高洛峰Original
2016-12-01 09:36:451617browse

The code is as follows:
$a = array(
'a','b','c'
);
require 'template/demo.php';//Reference template
?>

Template file:
Copy code The code is as follows:




Template test



 

 



Copy code The code is as follows:
Key value:


//Iteration of array
//smarty:
{foreach item=na from=$a key=key}
Key value: {$key}

{/foreach}
//Which one is better understood by PHP programmers?
//smarty also uses regular expressions to parse templates. PHP’s regular expressions are not that efficient...

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
Previous article:How to lock files in PHPNext article:How to lock files in PHP