我在 php 7.3 中出现了这个错误
不推荐使用:strpos():非字符串指针将来会被解释为字符串。使用显式 chr() 调用来保留当前行为
该行是:
if ($this->Category->getPath() && strpos('_', $this->Category->getPath())) {
Run Code Online (Sandbox Code Playgroud)
它似乎来自这个代码: strpos('_', $this->Category->getPath()
$this->Category->getPath() 可以返回这个值,例如:
int(8)
string(3) "8_9"
Run Code Online (Sandbox Code Playgroud)
小智 22
这对我有用
$suffix = strval($this->config->item('controller_suffix'));
$pos = !empty($suffix) ? strpos($class, $suffix) : FALSE;
if ($pos === FALSE)
{
$class .= $suffix;
}
parent::set_class($class);
Run Code Online (Sandbox Code Playgroud)
Mir*_*ina 12
您所要做的就是传入一个字符串作为strpos.
strpos('_', strval($this->Category->getPath()))
Run Code Online (Sandbox Code Playgroud)
或者,确保Category->getPath()返回字符串而不是混合类型。
小智 5
if (strpos($class, $suffix) === FALSE)
用。。。来代替
if ($suffix && strpos($class, $suffix) === FALSE)
在这里你可以看到详细信息
https://github.com/raknjak/CIMembership/issues/22