【问题标题】:Why is <? used for and which is the difference with <?php [duplicate]为什么是<?用于和与 <?php 有什么区别 [重复]
【发布时间】:2014-05-16 00:51:08
【问题描述】:

我正在学习 php 和 Ajax,但我看到一个使用 &lt;? 的代码。

<?php while($row=mysql_fetch_array($result)) { ?>
<option value=<?=$row['id']?>><?=$row['statename']?></option>

请你帮我理解为什么

【问题讨论】:

标签: php ajax


【解决方案1】:

阅读手册。

它将解释关于标签的一切。

http://www.php.net/manual/en/language.basic-syntax.phpmode.php

【讨论】:

    【解决方案2】:

    你可以使用

    &lt;?=$row['statement'] ?&gt;

    作为一种方便的简写方式

    &lt;?php echo $row['statement'] ?&gt;

    这可以提高可读性。

    【讨论】:

    • 非常感谢您的帮助..
    • 不客气!请使用htmlentities 使您的应用程序更安全。 php.net/htmlentities
    • 谢谢,我会看到的。
    猜你喜欢
    • 1970-01-01
    • 2011-09-13
    • 1970-01-01
    • 2010-11-27
    • 2017-02-17
    • 2011-09-27
    • 2013-04-22
    • 2012-03-29
    • 1970-01-01
    相关资源
    最近更新 更多