PHP strpos函数中针的长度有限制吗


Is there a limit on the length of the needle in the PHP strpos function?

我的问题很简单:

  1. strpos针的长度有限制吗
  2. 如果是这样,有没有办法绕过它

看起来我的长针不会触发位置,而我的短针会触发。

示例:

if (strpos($data, "You were not able to complete this job. Please try again at a later date. Do not hit your back button.") !== false)
//solves as false
if (strpos($data, "You were not able") !== false)
//returns the position

问题出在其他地方:虽然可能存在一些实现限制(例如2GB?),但不是这个限制。

据推测,只有的较长针头与输入不匹配:

  • 额外的空间?请记住,浏览器会"折叠"连续的HTML空白。因此,来自浏览器的"复制粘贴"可能与cURL读取的内容不同。(这也可以扩展到其他未在浏览器中显示为文本的源。)

  • 看起来像空间但不是的东西?(标签还是换行?)

  • 或者其他导致输入(和/或针刺)与预期不同的东西。。