PHP中的\n、\r、\t不起作用
$a="This string will $print.\nAnd this is another line.";
echo $a;
?>
程序的输入结果为什么是 This string will . And this is another line.
而不是
This string will .
And this is another line. 呢?
教材上面明明写的是后者啊!
而且我把\n换为\t或者\r输出结果是一样的,三个符号只是起到了空格的作用,而不是应有的换行、制表、回车的功能,为什么呢?恳请高手指点,谢谢!
------解决方案--------------------
<br /><?php<br /> $a="This string will $print.\nAnd this is another line.";<br /> echo $a;<br />?><br />
标签可定义预格式化的文本我理解也只是对这东西做了转化
<br><font color="#e78608">------解决方案--------------------</font><br>咳咳,<br>在html里, 回车/tab/空格 这些都叫做whitespace, <br>任何多个连续的whitespace在html都被显示为"一个空格"<br><br>这就是这么规定的...<br><br><pre class="brush:php;toolbar:false;">里会原样显示这些字符<br><br>也就是这么规定的,<br><br>所以说要看html的书....<br><br>如果要显示很多空格怎么办.... 楼上说了, <br>如果要回车... <br><p>等<br>如果要tab, ....如果你要显示表格最好是</p>
<div class="aritcle_card">
<a class="aritcle_card_img" href="/ai/1885">
<img src="https://img.php.cn/upload/ai_manual/000/000/000/175680420011975.png" alt="AiTxt 文案助手">
</a>
<div class="aritcle_card_info">
<a href="/ai/1885">AiTxt 文案助手</a>
<p>AiTxt 利用 Ai 帮助你生成您想要的一切文案,提升你的工作效率。</p>
<div class="">
<img src="/static/images/card_xiazai.png" alt="AiTxt 文案助手">
<span>15</span>
</div>
</div>
<a href="/ai/1885" class="aritcle_card_btn">
<span>查看详情</span>
<img src="/static/images/cardxiayige-3.png" alt="AiTxt 文案助手">
</a>
</div>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号