当前位置: 首页>>代码示例>>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;未经允许,请勿转载。