微信企业号推送换行

新手尝试微信企业号的消息推送,在content字符串里使用"/n"时异常"Unterminated string at character";

尝试使用"//n"后解决,代码如下:

Date currentDate = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
        String currentDateString = sdf.format(currentDate);
        StringBuffer buffer = new StringBuffer();
        buffer.append("【您有一个新公告】").append("\\n").append("\\n");
        buffer.append("【"+title+"】").append("\\n").append("\\n");
        buffer.append(content.split("<p>")[1].split("</p>")[0]).append("\\n").append("\\n");
        buffer.append("发布时间:  "+currentDateString);
       
        String contentPush = buffer.toString();
        String dk = ConfigContext.getValue("framework.academic.default.setup['notification']");
        SendMessWx.sendWeChatMsgText_util("@all", "", "", contentPush, "no", dk); 


猜你喜欢

转载自blog.csdn.net/Lossdate/article/details/77890853