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


PHP Arrays::getRef方法代碼示例

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


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

示例1: processFiles

 /**
  *
  * @param array $files
  * @param array $names Array of indexes of $files array representing current nesting level. E.g. if we are iterating over $files[k1][k2] then $names=[k1,k2]
  */
 private function processFiles(array $files, array $names = [])
 {
     foreach ($files as $name => $controlValue) {
         $names[] = $name;
         // MFU sends data in this format:
         //
         // array(
         //	"token" => "blablabla",
         //	"files" => array(
         //		0 => FileUpload(...),
         //		...
         //	)
         // )
         // expanded POST array with $names indexes
         $postFromHttpRequest = $this->httpRequest->getPost();
         $postArr = Arrays::getRef($postFromHttpRequest, $names);
         $isFormMFU = (is_array($controlValue) and isset($controlValue["files"]) and isset($postArr['token']));
         if ($isFormMFU) {
             $token = $postArr["token"];
             foreach ($controlValue["files"] as $file) {
                 self::processFile($token, $file);
             }
             // support for nested Nette\Forms\Container
         } elseif (is_array($controlValue)) {
             $this->processFiles($controlValue, $names);
         }
         // skip files not processed by MFU
         // they will be processed by Nette Forms
     }
 }
開發者ID:jkuchar,項目名稱:multiplefileupload,代碼行數:35,代碼來源:Controller.php

示例2: parse

 /**
  * @param array $cookies
  */
 private function parse(array $cookies)
 {
     foreach ($cookies as $raw) {
         if (!($cookie = static::readCookie($raw))) {
             continue;
         }
         if (isset($cookie['expires']) && \DateTime::createFromFormat(static::COOKIE_DATETIME, $cookie['expires']) < date_create()) {
             continue;
             // cookie already expired
         }
         if (strpos($name = $cookie['name'], '[') === FALSE) {
             $this->{$name} = $cookie['value'];
         } else {
             $keys = explode('[', str_replace(']', '', $name));
             $cookieValue =& Arrays::getRef($arr =& $this->{array_shift($keys)}, $keys);
             $cookieValue = $cookie['value'];
             unset($cookieValue);
         }
     }
 }
開發者ID:noikiy,項目名稱:Curl,代碼行數:23,代碼來源:HttpCookies.php

示例3: callOnRef

 /**
  * @param array
  * @param array
  * @param callable
  * @return mixed
  */
 public static function callOnRef(&$arr, $key, $callback)
 {
     if (!is_callable($callback, TRUE)) {
         throw new JedenWeb\InvalidArgumentException("Invalid callback.");
     }
     return $callback(Nette\Utils\Arrays::getRef($arr, $key));
 }
開發者ID:jedenweb,項目名稱:framework,代碼行數:13,代碼來源:Arrays.php


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