转换为数组

时间:2011-09-28 10:32:10

标签: php arrays drupal object

我有一个变量$code,其中包含以下数据。我希望$feeds_importer的内容为数组。我怎样才能做到这一点?

$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE;

/* Edit this to true to make a default feeds_importer disabled initially */ 

$feeds_importer->api_version = 1;
$feeds_importer->id = 'feed';
$feeds_importer->config = array(
    'name'        => 'Feed',
    'description' => 'Import RSS or Atom feeds, create nodes from feed items.',
    'fetcher'     => array(
        'plugin_key'  => 'FeedsHTTPFetcher',
        'config'      => array(
            'auto_detect_feeds' => FALSE,
            'use_pubsubhubbub'  => FALSE,
            'designated_hub'    => '',
        ),
    ),
    'parser' => array(
        'plugin_key' => 'FeedsSyndicationParser',
        'config'     => array(),
    ),
    'processor' => array(
        'plugin_key' => 'FeedsNodeProcessor',
        'config'     => array(
            'content_type'    => 'feed_item',
            'update_existing' => 0,
            'expire'          => '-1',
            'mappings'        => array(
                array(
                    'source' => 'title',
                    'target' => 'title',
                    'unique' => FALSE,
                ),
                array(
                    'source' => 'description',
                    'target' => 'body',
                    'unique' => FALSE,
                ),
                array(
                    'source' => 'timestamp',
                    'target' => 'created',
                    'unique' => FALSE,
                ),
                array(
                    'source' => 'url',
                    'target' => 'url',
                    'unique' => TRUE,
                ),
                array(
                    'source' => 'guid',
                    'target' => 'guid',
                    'unique' => TRUE,
                ),
            ),
            'input_format' => 0,
            'author'       => 0,
        ),
    ),
    'content_type'     => 'feed',
    'update'           => 0,
    'import_period'    => '1800',
    'expire_period'    => 3600,
    'import_on_create' => 1,
);

1 个答案:

答案 0 :(得分:3)

  

我想将feeds_importer的内容添加到数组中我该怎么做?

$array = (array) $feeds_importer;