當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Arrays::addOnKey方法代碼示例

本文整理匯總了PHP中Arrays::addOnKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP Arrays::addOnKey方法的具體用法?PHP Arrays::addOnKey怎麽用?PHP Arrays::addOnKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Arrays的用法示例。


在下文中一共展示了Arrays::addOnKey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get

 /**
 @param	templates	the input or output form of View::parseTemplateString
 	
 	where subtemplates is the passed into get as $templates. 
 	
 	 In the case of subtemplates, named ouput of each subtemplate along with the total previous output of the subtemplates is passed to the supertemplate.  The output of each subtemplate is passed by name in a $templates array, and the total output is available under the variable $input.
 @return output from the templates
 */
 protected function get($templates, $parseTemplates = true)
 {
     if ($parseTemplates) {
         //this parses all levels, so only need to run on non-recursive call
         if (!is_array($templates)) {
             $templates = self::parseTemplateString($templates);
         }
         $templates = $this->parseAliases($templates);
         $templates = self::attachChildren($templates);
     }
     $return['collect'] = array();
     while ($templates) {
         $template = array_pop($templates);
         if (is_array($template)) {
             if ($template[2]) {
                 $got = self::get($template[2], false);
                 if ($template[0]) {
                     $output = $this->getTemplate($template[0], array('templates' => $got['collect'], 'input' => $got['combine']));
                 }
                 Arrays::addOnKey($template[1] ? $template[1] : $template[0], $output, $return['collect']);
             } else {
                 $output = $this->getTemplate($template[0]);
                 Arrays::addOnKey($template[1] ? $template[1] : $template[0], $output, $return['collect']);
             }
         } else {
             $output = $this->getTemplate($template);
             Arrays::addOnKey($template, $output, $return['collect']);
         }
         $return['combine'] .= $output;
     }
     return $return;
 }
開發者ID:jstacoder,項目名稱:brushfire,代碼行數:40,代碼來源:View.php

示例2: add

 /**
 @param	options	various options:
 	hookName : sets hookname, so as to allow identifying it for deletion or modification
 	deleteAfter : #, deletes after # of uses
 */
 static function add($spotName, $callback, $options = null)
 {
     $hook = array('callback' => $callback, 'options' => $options);
     return Arrays::addOnKey($options['hookName'], $hook, self::$hooks[$spotName]);
 }
開發者ID:jstacoder,項目名稱:brushfire,代碼行數:10,代碼來源:Hook.php


注:本文中的Arrays::addOnKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。