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

时间:2012-11-29 11:13:38

标签: php

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);"**

那么错误在哪里?

1 个答案:

答案 0 :(得分:2)

$rows = $db->loadResultArray();
var_dump($rows);
$daystring = implode(',' , $rows);

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

相关问题