当前位置: 首页>>代码示例>>PHP>>正文


PHP SimplePie_Misc::array_merge_recursive方法代码示例

本文整理汇总了PHP中SimplePie_Misc::array_merge_recursive方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie_Misc::array_merge_recursive方法的具体用法?PHP SimplePie_Misc::array_merge_recursive怎么用?PHP SimplePie_Misc::array_merge_recursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimplePie_Misc的用法示例。


在下文中一共展示了SimplePie_Misc::array_merge_recursive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Create a new cache object
  * @param string $location Location string (from SimplePie::$cache_location)
  * @param string $name     Unique ID for the cache
  * @param string $type     Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
  */
 public function __construct($location, $name, $type)
 {
     $this->options = array('host' => '127.0.0.1', 'port' => 11211, 'extras' => array('timeout' => 3600, 'prefix' => 'simplepie_'));
     $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
     $this->name = $this->options['extras']['prefix'] . md5("{$name}:{$type}");
     $this->cache = new Memcached();
     $this->cache->addServer($this->options['host'], (int) $this->options['port']);
 }
开发者ID:janeklb,项目名称:moodle,代码行数:14,代码来源:Memcached.php

示例2: __construct

 /**
  * Create a new cache object
  *
  * @param string $location Location string (from SimplePie::$cache_location)
  * @param string $name Unique ID for the cache
  * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
  */
 public function __construct($location, $name, $type)
 {
     $this->options = array('user' => null, 'pass' => null, 'host' => '127.0.0.1', 'port' => '3306', 'path' => '', 'extras' => array('prefix' => '', 'cache_purge_time' => 2592000));
     $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
     // Path is prefixed with a "/"
     $this->options['dbname'] = substr($this->options['path'], 1);
     try {
         $this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
     } catch (PDOException $e) {
         $this->mysql = null;
         return;
     }
     $this->id = $name . $type;
     if (!($query = $this->mysql->query('SHOW TABLES'))) {
         $this->mysql = null;
         return;
     }
     $db = array();
     while ($row = $query->fetchColumn()) {
         $db[] = $row;
     }
     if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db)) {
         $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))');
         if ($query === false) {
             trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING);
             $this->mysql = null;
             return;
         }
     }
     if (!in_array($this->options['extras']['prefix'] . 'items', $db)) {
         $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))');
         if ($query === false) {
             trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING);
             $this->mysql = null;
             return;
         }
     }
 }
开发者ID:janeklb,项目名称:moodle,代码行数:45,代码来源:MySQL.php

示例3: array_merge_recursive

 public static function array_merge_recursive($array1, $array2)
 {
     foreach ($array2 as $key => $value) {
         if (is_array($value)) {
             $array1[$key] = SimplePie_Misc::array_merge_recursive($array1[$key], $value);
         } else {
             $array1[$key] = $value;
         }
     }
     return $array1;
 }
开发者ID:TBWAsg,项目名称:screens,代码行数:11,代码来源:simplepie.php


注:本文中的SimplePie_Misc::array_merge_recursive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。