How to search the keyword 50 words before and after?
$content = Strip_tags ($content);
Preg_match ("/[^u4e00-u9fa5]{1,90}{$keyword}[^u4e00-u9fa5]{1,90}/", $content, $m);
This is my original practice, there will be garbled
$keyword = "satisfied"; $content = <<
<>
Service
We have been delivering the services as a key component of the integrated service delivery to the design sequence, test will meet the needs of customers, while real cost savings and ensure a high level of service providers.
Our engineering and welfare team will work with you to understand your specific business needs to design a plan from the Division and drawing components to meet your employees # 39; requirements while maintaining compliance with your strategy, budget and market practices.
We will actively participate in your staff welfare program and the implementation process. We hope that with your long-term approach, re-think the whole welfare strategy, help the complex and improve the reality and feel of the plan.
EOT;
Reply to discussion (solution)
Preg_match ("/[\w\w]{1,90}{$keyword}[\w\w]{1,90}/u", $content, $m);
Preg_match ("/[\w\w]{1,90}{$keyword}[\w\w]{1,90}/u", $content, $m);
There will be a bunch of spaces in front of the matched content.
Then you can match the space after you remove it.