smarty replace line breaks

拜拜、爱过 提交于 2019-12-10 17:57:17

问题


At the time of writing this, the smarty.net website appears to be down.

Anyway, how do I replace line breaks with a space in a smarty variable? Is it something like this {$var|regex_replace:'[\\r\\n]':'\s'} ? I tried it but it didn't work.


回答1:


Try this if it works:

{$var|regex_replace:"/[\r\n]/" : " "}


来源:https://stackoverflow.com/questions/6078804/smarty-replace-line-breaks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!