Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个来自语言文件的字符串,其中包含带有当前语言文本的字符串。
$str = 'blabla\n\nmore blabla';
$str 将在 \n 必须是换行符的文本区域中使用如果我将它放在双引号内,这将有效。
问题是 $str 总是用单引号引起来。我一直在谷歌搜索和搜索这个网站。有很多类似的问题,但我没有设法找到解决方案。
如何将我的单引号字符串(带有文字“\n”)转换为双引号字符串(其中“\n”转换为换行符)?
$str = str_replace('\n', "\n", $str);