使用php从mysql db回显的值的格式文本显示

时间:2013-09-04 16:30:14

标签: php mysql

当我输入一个像我的表格上的文本区域中的rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr非常欢迎您的帮助

2 个答案:

答案 0 :(得分:0)

我认为你无法做任何事情,除了截断字符或在X个字符后将它分开。我'截断...

function truncate_chars($string, $limit, $break=' ', $pad='...') {
    // return with no change if string is shorter than $limit
    if(strlen($string) <= $limit) return $string;

        $string = substr($string, 0, $limit);
        if(false !== ($breakpoint = strrpos($string, $break))) {
         $string = substr($string, 0, $breakpoint);
     }
     return $string . $pad;
}

echo truncate_chars($string);

答案 1 :(得分:0)

在大表格单元格上使用word-break: break-all css属性值。

http://jsfiddle.net/GgqL4/