douhutongvm382381 2012-12-06 10:22
浏览 68
已采纳

或 在php中回显不打印[重复]

Possible Duplicate:
Print newline in PHP in single quotes
Difference between single quote and double quote string in php

$unit1 = 'paragrahp1';
$unit2 = 'paragrahp2';
echo '<p>' . $unit1 . '</p>
';
echo '<p>' . $unit2 . '</p>';

This is displaying (on view source):

<p>paragraph1</p>
<p>paragraph2</p>

but isnt what I’m expecting, not printing the new line, what can be?

  • 写回答

6条回答 默认 最新

  • douyun1860 2012-12-06 10:23
    关注

    PHP only interprets escaped characters (with the exception of the escaped backslash \\ and the escaped single quote \') when in double quotes (")

    This works (results in a newline):

    "
    "
    

    This does not result in a newline:

    '
    '
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料