gpt4 book ai didi

php - 已弃用 : strpos(): Non-string needles will be interpreted as strings in the future

转载 作者:行者123 更新时间:2023-12-01 16:15:50 25 4
gpt4 key购买 nike

我在 php 7.3 中出现此错误

Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

该行是:

if ($this->Category->getPath() && strpos('_', $this->Category->getPath())) {

它似乎来自这段代码:strpos('_', $this->Category->getPath()

$this->Category->getPath() 可以返回此值,例如:

int(8)  
string(3) "8_9"

最佳答案

这对我有用

$suffix = strval($this->config->item('controller_suffix'));
$pos = !empty($suffix) ? strpos($class, $suffix) : FALSE;
if ($pos === FALSE)
{
$class .= $suffix;
}
parent::set_class($class);

关于php - 已弃用 : strpos(): Non-string needles will be interpreted as strings in the future,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56201525/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com