dsg7513 2013-08-12 23:48
浏览 29
已采纳

线路终结器在这个php片段之后去了哪里?

Here is my HTML code.

<?php
   // php code that adds a single div
?>

<script id = "conf">

There is clearly two return characters after the final

?>

However, the output is like this:

<div id='conf'></div>
<script id = "conf">

It seems a return character (line terminator ) was "sucked up". It appears that the PHP snippet does this some how.

Why is this?

Is this expected behavior?

I just find it odd. Obviously a return character could be added, but how is one subtracted? Just find it odd.

Clarification:

I'm talking about under view source. Not the actual HTML document.

  • 写回答

1条回答 默认 最新

  • douxi2011 2013-08-12 23:50
    关注

    The closing tag for the block will include the immediately trailing newline if one is present.

    As per the PHP manual.

    I agree it seems a bit strange. I ran into this behavior when trying to format and indent the resulting HTML. To force a newline, add a space at the end of the line and it will be rendered.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab