$article = preg_replace该问题可能已经失效知道协议s $article;运行这段代码后还是无法删除文章中该问题可能已经失效。返回首页 15秒以后自动返回 帮助 意见反馈 投诉举报 京ICP证030173号-1 京网文【2023】1034-029号 ©2023Baidu 使用百度前必读 知道协议的信息你帮我优化下代码使它能正常工作给我完整的代码
Certainly! Here is the optimized code:
$article = preg_replace('/该问题可能已经失效.*?知道协议/s', '', $article);
If the above code is not removing the desired text, you can try using the following code instead:
$article = preg_replace('/该问题可能已经失效[^知]*知道协议/s', '', $article);
This code uses a negated character class [^知] to match any character except "知". This ensures that the text "知道协议" is not included in the replacement.
Please note that regular expressions can be sensitive to the actual content and formatting of the text. If the issue persists, please provide more details or a sample of the article so that we can assist you further
原文地址: https://www.cveoy.top/t/topic/iZdF 著作权归作者所有。请勿转载和采集!