简体   繁体   中英

Php - replace question mark sign

Is it possible to replace php tags to something custom?

Smarty library can assign values and then render them so instead of:

<?php echo $name; ?> 

you can just assign value in business logic and then in template just say

{name} 

I'd like to make my own function/class/library so when I write { in index.tpl, browser will think its < ?php echo ..

Can somebody point me somewhere?

replace {variable} with regexps and then eval-it

here is simple template engine, very similar to your idea

i mean, better is use existing templates engines, like Latte , Twig or Smarty . Its not necessary reinventing wheel :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM