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

The simplest and simplest template engine: PHP native template engine

WBOY
WBOYOriginal
2016-07-25 09:05:001117browse
...Uh~ Adding a caching mechanism would be perfect! I don’t know if the performance of writing this way will be higher than those of regular template engines?


  1. $a = array(
  2. 'a','b','c'
  3. );
  4. require 'template/demo.php';//Reference template
  5. ?>
Copy code
  1. Template file:
  2. Template test
  3. < pre>
Copy code
  1. Key value:
  2. //Iteration of array
  3. //smarty:
  4. {foreach item=na from=$a key=key}
  5. Key value: {$key}
  6. {/foreach}
  7. //For php program Which member is better understood?
  8. //smarty also uses regular expressions to parse templates. PHP’s regular expressions are not that efficient...
Copy code


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