PHP脚本,通常使用打开和关闭脚本标签. [英] PHP scripts, is it normal to use open and close script tags.

查看:54
本文介绍了PHP脚本,通常使用打开和关闭脚本标签.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.代码和有什么不一样:

 <?php 
// -一些功能
?> 
<   div     ="  文本" <  >  



 <?php 
// -一些功能
?> 
<   div     ="  文本" 上的某些文本<? php ' ?> ./div  解决方案

结果是相同的.

在这种情况下,第二个就没有用了,为了简单起见,我会选择第一个.

此外,如果要在HTML文本中放入变量,函数和其他结果,那么这样做是一件好事.


hi. What is the difference between code:

<?php 
// -- some functions
?>
<div class="text">Some text on page.</div>



<?php 
// -- some functions
?>
<div class="text">Some text on <?php echo 'page' ?>.</div>



I just want to know, is it ok to open and close php scripts.

解决方案

The result is the same.

In that case the second is not useful and I would go for the first one for the sake of easiness.

Apart of that it is a good thing to do that if you want to put variables, functions and other results in the HTML text.


这篇关于PHP脚本,通常使用打开和关闭脚本标签.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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