我每次访问我的wordpress网站时都会在apache日志中收到此警告:
[error] [client myiphere] PHP警告:implode():在第16行的/var/www/mysitepath/wp-content/themes/mytheme/noscript/views/list-view.php中传递的参数无效,参考文献:http ://www.example.com/
这是list-view.php的一部分:
<?php
$mytheme = mytheme::getInstance();
$currentContentLayout = $mytheme->WPData['currentContentLayout'];
$contentLayout = $mytheme->settings->contentLayouts->{$currentContentLayout};
$headerClasses = array();
if('no' == $contentLayout->metaPosition){
$headerClasses = 'no-meta';
} else {
$headerClasses[] = 'meta-' . $contentLayout->metaPosition;
}
?>
<div class="mytheme-list-view row">
<div class="large-12 columns">
<?php while(have_posts()){ the_post();?>
<article id="post-<?php the_ID();?>" <?php post_class();?> data-mytheme-post-from-id="<?php the_ID();?>">
<header class="entry-header <?php echo implode(' ', $headerClasses);?>">
...
...
代码有什么问题吗?谢谢
2 回答
您需要更改此行:
对此:
当
$headerClasses
是字符串时会发生此问题,因为implode()
将数组作为第二个参数 .implode
函数需要array
作为参数,而在if条件下,您传递简单字符串 . 你这样使用shuld第二个 . 你可以检查这样的impload