PHP Eval that evaluates HTML & PHP

前端 未结 5 707
北海茫月
北海茫月 2020-12-06 01:22

I\'m messing around with templating and I\'ve run into a situation where I need to echo to the browser a template that contains html & php. How do I evaluate the PHP and

5条回答
  •  萌比男神i
    2020-12-06 02:07

    In case you are trying to do this with a string of mixed HTML/PHP (like from a database, as I was), you can do it this way:

    eval(' ?>'.$htmlandphp.'

    More info: http://blog.5ubliminal.com/posts/eval-for-inline-php-inside-html/ (note this is a dead link as of 2014-3-3)

提交回复
热议问题