How to design the keyword code in the highlighted search results! Keywords are all divided into words. For example, if you search for the word "Xu Jinglei" and split it into: & nbsp; "Xu Jing" & nbsp; "Jing Lei", you will not discuss the effect of the word segmentation module, I would like to ask you how to highlight "Xu Jing" and "Jing Lei" in the search results, because use str_rep to calculate and highlight the keyword code design ideas in the search results! Keywords are all divided into words.
For example, search: "Xu Jinglei"
Split into two words: "Xu Jing" and "Jing Lei"
I will not discuss the effect of the word segmentation module. how can we highlight "Xu Jing" and "Jing Lei" in the search results? because we use str_replace to replace "Xu Jing" for the first time, it became like "Xu Jing", so I went to search for "Jing Lei" for the second time, because there was "" between "Jing" and "Lei", so I couldn't find it.
I don't know how to solve this problem. thank you for your ideas or code.
------ Solution --------------------
Preg_replace (array, array, string)
------ Solution --------------------
For example, search: "Xu Jinglei"
Split into two words: "Xu Jing" and "Jing Lei"
"Xu Jing", the starting position and cheap amount in "Xu Jinglei" is)
"Jinglei", the starting position and cheap amount in "Xu Jinglei" is (1, 2)
--> After merging, it is (0, 3)
------ Solution --------------------
Preg_replace (array, array, string );??
This cannot be solved, right?
------ Solution --------------------
The method is the same to replace the key string, just to traverse the word segmentation array cyclically.
------ Solution --------------------
Support upstairs
I think the highlighted keyword of maxthon is like this.
------ Solution --------------------
Write a function by yourself.
System function estimation is unlikely.
------ Solution --------------------
Is the output content replaced? How can I replace the content to be checked?
------ Solution --------------------
Follow up...
------ Solution --------------------
Favorites
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.