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


PHP CString::splitIntoChars方法代碼示例

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


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

示例1: __construct

 /**
  * Creates a URL query from a query string or as empty.
  *
  * Just like in any valid URL, a provided query string is not expected to contain characters that cannot be
  * represented literally and percent-encoding is expected to be used for any such characters. The query string
  * should not contain a leading "?" because it's rather a delimiter that is used to separate the query string from
  * the preceding URL part.
  *
  * @param  string $queryString **OPTIONAL. Default is** *create an empty URL query*. The source query string.
  * @param  reference $parsingWasFruitful **OPTIONAL. OUTPUT.** After the object is constructed, this parameter,
  * which is of type `bool`, tells whether the parsing of the query string resulted in any valid fields.
  */
 public function __construct($queryString = null, &$parsingWasFruitful = null)
 {
     assert('!isset($queryString) || is_cstring($queryString)', vs(isset($this), get_defined_vars()));
     if (isset($queryString)) {
         if (!CString::isEmpty($queryString)) {
             // Before parsing, normalize field delimiters to the default one (e.g. make ";" to be "&").
             $delimiters = CString::splitIntoChars(self::$ms_fieldDelimiters);
             $fields = CString::split($queryString, $delimiters);
             $queryString = CArray::join($fields, self::$ms_fieldDelimiters[0]);
             // Parse the query string.
             parse_str($queryString, $this->m_query);
             if (!is_cmap($this->m_query)) {
                 $this->m_query = CMap::make();
             }
             // Recursively convert any PHP's associative array with sequential keys into a CArray.
             foreach ($this->m_query as &$value) {
                 $value = self::recurseQueryValueAfterParsing($value, 0);
             }
             unset($value);
         } else {
             $this->m_query = CMap::make();
         }
         $parsingWasFruitful = !CMap::isEmpty($this->m_query);
     } else {
         $this->m_query = CMap::make();
     }
 }
開發者ID:nunodotferreira,項目名稱:Phred,代碼行數:39,代碼來源:CUrlQuery.php


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