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

那么错误在哪里呢?

4

1 回答 1

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

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

于 2012-11-29T11:15:52.080 回答