PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in

PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in

谁能帮我解决这个问题? 我已将 PHP 版本从 7.4 更改为 8 并收到此错误:


PHP Fatal error:  Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /home/iranhfc/maransanat.com/wp-content/themes/maran/lib/utilities.php:63
Stack trace:
#0 /home/iranhfc/maransanat.com/wp-content/themes/maran/lib/utilities.php(63): implode()
#1 /home/iranhfc/maransanat.com/wp-content/themes/maran/lib/framework.php(19): require_once('/home/iranhfc/m...')
#2 /home/iranhfc/maransanat.com/wp-content/themes/maran/lib/framework.php(70): PixflowFramework::Pixflow_Require_Files()
#3 /home/iranhfc/maransanat.com/wp-content/themes/maran/functions.php(97): require_once('/home/iranhfc/m...')
#4 /home/iranhfc/maransanat.com/wp-settings.php(525): include('/home/iranhfc/m...')
#5 /home/iranhfc/maransanat.com/wp-config.php(82): require_once('/home/iranhfc/m...')
#6 /home/iranhfc/maransanat.com/wp-load.php(37): require_once('/home/iranhfc/m...')
#7 /home/iranhfc/maransanat.com/wp-blog-header.php(13): require_once('/home/iranhfc/m...')
#8 /home/iranhfc/maransanat.com/index.php(17): require('/home/iranhfc/m...')
#9 {main}
  thrown in /home/iranhfc/maransanat.com/wp-content/themes/maran/lib/utilities.php on line 63

代码:

if(strpos(implode(get_option('active_plugins'),' '),"bookly")>0){
    $library_to_include[]='bookly';
}

如@GetSet 所述,implode 中的参数是错误的。

if(strpos(implode(' ', get_option('active_plugins')),"bookly")>0){
    $library_to_include[]='bookly';
}

implode() 函数第二个参数必须是数组。

已弃用第二个参数中的非数组数据类型。 https://www.php.net/manual/en/migration74.deprecated.php