substr_count():偏移量不包含在字符串中

时间:2018-11-30 09:31:20

标签: php wordpress

我在插件的以下代码行中的vps服务器上遇到了这个烦人的错误(请参见标题):

$distance = substr_count($image_path, '/', $offset) + substr_count($content_path, '/', $offset);

插件获取提要,并在vps上为特定提要带来错误的图像。具有相同设置的相同插件可以在共享主机上的暂存站点上正常运行。两台服务器上的php版本7.2和php设置都相同。

怎么了?

2 个答案:

答案 0 :(得分:0)

需要检查$image_path$content_path$offset
我认为它们在两台服务器上都不一样。

在这种情况下,您可以使用file_put_contents

file_put_contents('debug.txt', var_export($image_path, true), FILE_APPEND);
file_put_contents('debug.txt', var_export($content_path, true), FILE_APPEND);
file_put_contents('debug.txt', var_export($offset, true), FILE_APPEND);

答案 1 :(得分:0)

这是服务器配置错误。

相关问题