How to extract a fixed number of characters from the content of the & amp; lt; p & amp; gt; tag as a post introduction? I think Baidu Post Bar extracts a certain number of characters from the front of a post and displays them as an introduction to the post. Assume that the following is a content example: & amp; lt; p & amp; gt; somecontent... & amp; lt; p & amp; gt ;...
What is the description of a post by extracting a fixed number of characters from the TAG content? I think Baidu Post Bar extracts a certain number of characters from the front of a post and displays them as an introduction to the post. For example,
some content...
...
......
...
Because one
The content length in the tag is not fixed, and it may start with an image.
Tag, or insert Code
Tags, and so on.
The tag can be extracted with 50 characters. If not, can php be used efficiently?
Reply content:How
What is the description of a post by extracting a fixed number of characters from the TAG content? I think Baidu Post Bar extracts a certain number of characters from the front of a post and displays them as an introduction to the post. For example,
some content...
...
......
...
Because one
The content length in the tag is not fixed, and it may start with an image.
Tag, or insert Code
Tags, and so on.
The tag can be extracted with 50 characters. If not, can php be used efficiently?
Hello, I feel that I can use regular expressions to match the content and extract the content using preg. If this is not the case, I can use js traversal. I hope you can try again. If not, please confirm.
Regular Expression + String Truncation
] +> (.*?)
Simple regular expressions.
Assume that you have found
Tag, which can be created using substr + strip_tags
How to find
Label. You can use regular expressions or PHPQuery.