Moh*_*Ram 3 html php textarea smarty
PHP代码
<?php
$content = "check1\r\ncheck2\r\ncheck3\r\nend..."
$order = array("\r\n");
$replace = "\n";
$content= str_replace( $order, $replace, $content);
$smarty->assign('content', $content);
?>
Run Code Online (Sandbox Code Playgroud)
查看页面(一个聪明的模板)
<textarea>{$content}<textarea>
Run Code Online (Sandbox Code Playgroud)
输出:
check1\r\ncheck2\r\ncheck3\r\nend...
Run Code Online (Sandbox Code Playgroud)
我希望输出如下
check1
check2
check3
end...
Run Code Online (Sandbox Code Playgroud)
在textarea内.我已经换成\r\n了\n,但即便如此,我也无法得到我想要的输出.我的代码有什么问题?先感谢您.
它看起来像你有类似的问题,以这个.
如果我正确阅读,请尝试:
<textarea>{$content|stripcslashes}<textarea>
Run Code Online (Sandbox Code Playgroud)