返回列表 回复 发帖

[网络] Discuz 6 升级到7 后 内容不会自动换行解决办法

开启了html 功能  用代码模式不能换行了  一定要使用<br>才能换行

在/include/discuzcode.func.php
查找:
return $htmlon || $allowhtml ? $message : nl2br(str_replace(array("\t", '   ', '  '), array('        ', '   ', '  '), $message));

修改为:
return $htmlon || $allowhtml ? nl2br($message) : nl2br(str_replace(array("\t", '   ', '  '), array('        ', '   ', '  '), $message));

哈哈~!!!!!!!!!!!!!!!!!!
如果找不到 就找


return $htmlon || $allowhtml ? $message


把里面的$message改成nl2br($message)就行了


如果还解决不了,就修改成如下格式

  1. return $htmlon || $allowhtml ? nl2br($message) :  nl2br(str_replace(array("\t", '   ', '  '), array('&nbsp; &nbsp; &nbsp; &nbsp; ',
  2. '&nbsp; &nbsp;', '&nbsp;&nbsp;'), $message));
复制代码
6.0升级到7.0版本后帖子出现乱码

自从前段时间我论坛升级到7.0版本后帖子内出现:换行码,HTML码,字体码

Discuz!7.0 正式版对发 html 帖的权限进行了变更,极大的提高了安全性,并且使得 html 权限与其他权限的设置保持统一。

变更之后,开启 html 权限的必须步骤:
1.开启版块 html 权限;
2.开启用户组 html 权限。

废弃了原有的“只要开启版块 html 权限,所有会员都可以在该版块发 html 帖”的机制。

如果升级后原来已经开启 html 版块的帖子无法解析 html 代码,可以在论坛后台执行以下 SQL 修复:

  1. UPDATE cdb_forums f, cdb_posts p SET p.htmlon=p.htmlon|1 WHERE p.fid=f.fid AND f.allowhtml='1';
复制代码
返回列表