开发者

How do you call the way to insert PHP code in an HTML archive?

开发者 https://www.devze.com 2023-01-14 17:47 出处:网络
here below explains how to embed PHP code in HTML 开发者_运维技巧files. Is there any name to referrer that way of writing PHP ?

here below explains how to embed PHP code in HTML 开发者_运维技巧files. Is there any name to referrer that way of writing PHP ?

http://onlamp.com/pub/a/php/2001/05/03/php_foundations.html

Javi


I assume you are referring to the syntax in that article that looks like this:

<?php if(conditions): ?>
... HTML CODE ...
<?php endif; ?>

That's called the Alternative Syntax for Control Structures. Unfortunately, that doesn't really roll off one's tongue very well.

The article also shows an example of the short open tag:

<?=$var?>


You just took it wrong. It is not PHP being embedded in HTML, but HTML being embedded in PHP.
To run PHP code a PHP interpreter is required. And usual browser doesn't have one.
Thus, you can add PHP code to HTML archive but it just won't work.

While embedding itself is called Escaping from HTML

0

精彩评论

暂无评论...
验证码 换一张
取 消