duanlu0386 2017-07-10 14:03
浏览 26
已采纳

这是什么意思“块的结束标记将包括如果存在的那个立即尾随的换行符”?

I am learning to php from php.net but i am confused with the sentence The closing tag for the block will include the immediately trailing newline if one is present. at php.net.

Can anyone tell me what does it says, what is mean by if one is present in this sentence The closing tag for the block will include the immediately trailing newline if one is present. ?

You will see that sentence line at the end of the first paragraph at php.net

  • 写回答

1条回答 默认 最新

  • dongzhansong5785 2017-07-10 14:08
    关注

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

    Meaning, ?> is taken as the block closing delimiter, and both are removed from the final output. I expect this is to remove unnecessary blank lines in code like this:

    <ul>
    <?php foreach (..) ?>
        <li>..</li>
    

    However, it does make it hard to control output of newlines.

    EDIT

    Example: if you run

    hello
    
    there
    <?php echo 'bye'; ?>
    
    <?php echo 'there'; ?> 
    

    It prints

    hello
    
    there
    bye
    there
    

    instead of

    hello
    
    there
    bye
    
    there
    

    Ignoring the space there is between <?php echo 'bye'; ?> and <?php echo 'there'; ?>

    Note: If you want you can use (?> <br>) to output the blank line but this will also output the space between > and <

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

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思