首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >警告: implode() [function.implode]:传入的参数无效...第50行

警告: implode() [function.implode]:传入的参数无效...第50行
EN

Stack Overflow用户
提问于 2012-11-29 19:13:38
回答 1查看 1.6K关注 0票数 2
代码语言:javascript
复制
class  plgSystemUnpublishfront extends JPlugin
{
    /**
     * Constructor
     *
     * For php4 compatability we must not use the __constructor as a constructor for plugins
     * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
     * This causes problems with cross-referencing necessary for the observer design pattern.
     *
     * @param   object      $subject The object to observe
      * @param  array       $config  An array that holds the plugin configuration
     * @since   1.0
     */
    function plgSystemUnpublishfront(& $subject, $config)
    {
        parent::__construct($subject, $config);
    }

    /**
     * Fixes the $my global if the user was restored by the remember me plugin
     */
    function onAfterInitialise()
    {
        $days       = $this->params->get('days');
        $startpoint = $this->params->get('startpoint');
        $excludes   = $this->params->get('excludes',0);

        $db = & JFactory::getDBO();

        $query = "SELECT id FROM #__content AS"
        ."\n WHERE DATE_ADD($startpoint, INTERVAL $days DAY) < NOW() AND id NOT IN($excludes)";
        $db->setQuery($query);
        $rows = $db->loadResultArray();

        $daystring = implode(',' , $rows);

        $query = "DELETE FROM #__content_frontpage WHERE content_id IN($daystring)";
        $db->setQuery($query);
        $db->Query();
    }
}
**line 50 is "$daystring = implode(',' , $rows);"**

那么错误在哪里呢?

EN

回答 1

Stack Overflow用户

发布于 2012-11-29 19:15:52

代码语言:javascript
复制
$rows = $db->loadResultArray();
var_dump($rows);
$daystring = implode(',' , $rows);

这里$rows返回的不是数组,这就是给出警告的原因。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13624500

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档