赞
踩
接口向数据库插入数据时,转换:
$intro = preg_replace('/\n/','<br>', trim($_POST['intro']));
获取数据之后转换:
4info['intro] = preg_replace("/<br>/", "\n", $content['intro']);
js赋值转换:
var intro = '<?php echo str_replace(["n", "<br>"],'',str_replace(chr(13), 'n', $info['intro'])); ?>'
console.log(intro)
参考:
https://blog.csdn.net/coco1118/article/details/84423857
https://www.jb51.cc/php/874402.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。