Content.php
662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/1/24
 * Time: 17:44
 */
namespace Hanson\Vbot\Support;
/**
 * Content 处理类
 *
 * Class Content
 * @package Hanson\Vbot\Support
 */
class Content
{
    /**
     * 格式化Content
     *
     * @param $content
     * @return string
     */
    public static function formatContent($content)
    {
        return self::htmlDecode(self::replaceBr($content));
    }
    public static function htmlDecode($content)
    {
        return html_entity_decode($content);
    }
    public static function replaceBr($content)
    {
        return str_replace('<br/>', "\n", $content);
    }
}