我想获得两个单词(word1
和word2
)之间的内容(文本),例如:
word1blablabla Poetry can be divided into several genres, or categories. word2 blablabla
所以内容= blablabla Poetry can be divided into several genres, or categories.
但是,有时问题word1
和word2
可以是大写字母或小写字母。另一个问题是结果中仍然会打印word1
。它应该打印出来。如何处理这个问题?谢谢你:))
这是代码:
$file = 'word1 blablabla word1 Poetry can be divided into several genres, or categories. word2 blablabla ';
$word1='word1';
$word2='word2';
$between = substr($file, strpos($file, $word1), strpos($file, $word2) - strpos($file, $word1));