How to automatically intercept the content of an article as an introduction to the article? what I want to achieve is to automatically intercept 100 words as an introduction to the article when adding an article, but because the content is formatted text, how can I remove the html format and only intercept the part of the article? Share to: how to automatically intercept the content of an article as an introduction to the article
What I want to achieve is that when I add an article, the content is automatically truncated by 100 words as the article introduction, but because the content is formatted text, how can I remove the html format, what about intercepting only part of the article?
Share: More
------ Solution --------------------
Php provides the strip_tag function to remove html tags.
To prevent Chinese characters from being truncated, php provides the iconv_substr and mb_substr functions.