首先使用PHP还是HTML?还是重要? [英] PHP or HTML first or does it matter?

查看:138
本文介绍了首先使用PHP还是HTML?还是重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这首先是什么问题,PHP或HTML代码?



例如:PHP是在HTML之前,在HTML之后还是根本没有关系?

 <?php 

echoThis is text;

?>


< html>
< head>
< / head>
< body>
< center>
< font size =2>这是文字< / font>
< / center>
< / body>
< / html>






或者:

 < html> 
< head>
< / head>
< body>
< center>
< font size =2>这是文字< / font>
< / center>
< / body>
< / html>

<?php

echoThis is text;

?>






或者:

 < html> 
< head>
< / head>
< body>

<?php

echoThis is text;

?>

< / body>
< / html>


解决方案

第三个是正确的方法文本在主体中回显出来)。



PHP可以跳入和跳出HTML,如上所示。

 < html> 
< head>
< / head>
< body>
< center>
< font size =2><?php echoThis is text; ?>< /字体>
< / center>
< / body>
< / html>


I have a possible stupid question, but I'll ask it anyway.

Does it matter what goes first, PHP or HTML code?

For example: Does PHP go before HTML, after HTML or does it matter at all?

<?php

echo "This is text";

?>


<html>
<head>
</head>
<body>
<center>
<font size="2">This is text</font>
</center>
</body>
</html>


Or:

<html>
<head>
</head>
<body>
<center>
<font size="2">This is text</font>
</center>
</body>
</html>

<?php

echo "This is text";

?>


Or:

<html>
<head>
</head>
<body>

<?php

echo "This is text";

?>

</body>
</html>

解决方案

The third one is the correct way (assuming you want the text to echo out in the body).

PHP can jump in and out of HTML as you have shown above.

<html>
<head>
</head>
<body>
<center>
<font size="2"><?php echo "This is text"; ?></font>
</center>
</body>
</html>

这篇关于首先使用PHP还是HTML?还是重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆