Home  >  Article  >  Backend Development  >  PHP native template engine The simplest template engine_PHP tutorial

PHP native template engine The simplest template engine_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:19:24796browse

Copy code 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:



< head>

Template Test



 

 



Copy code Code 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...

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325311.htmlTechArticleCopy the code as follows: ?php $a = array( 'a','b','c' ) ; require 'template/demo.php';//Reference template? Template file: Copy the code as follows: !DOCTYPE html html lang="zh" head...
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