尾随html文本(使用PHP)

Asking for the term or certain html/php code where you can trail off part of the text. I have a long description where id like to show just a small part of its intro and add the trailing off dots. By clicking on read more it redirects to its full article.

1

Take a look at substr

substr — Return part of a string

substr ( string $string , int $start, int $length ) 

Returns the string specified by start and end.

echo substr('abcdef', 1);     // bcdef
echo substr('abcdef', 1, 3);  // bcd
echo substr('abcdef', 0, 4);  // abcd
echo substr('abcdef', 0, 8);  // abcdef
$text = "this is a long string of text that we need to snip";
$sniplength = 15;

echo substr($text,0,$sniplength)."...";