是否有标准函数可以换行到<br />
在 ASP.Net MVC 中编码?
最佳答案
现在有:
public static class StockStandardFunctions
{
public static string Nl2br(this string input)
{
return input.Nl2br(true);
}
public static string Nl2br(this string input, bool is_xhtml)
{
return input.Replace("\r\n", is_xhtml ? "<br />\r\n" : "<br>\r\n");
}
}
修改为更严格地遵循 nl2br 的 php 规范(感谢 Max 指出)。这仍然假设\r\n 换行......
关于php - 是否有类似 ASP.NET MVC 的 PHP 函数 nl2br() 的东西?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2738192/