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


PHP CString::fromBool10方法代码示例

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


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

示例1: __construct

 /**
  * Creates an HTTP cookie to be sent along with an HTTP response.
  *
  * Internally, the value of a cookie is always stored as a string. If the cookie's value was provided as an array
  * or map, it's encoded into JSON and is stored as a JSON string. Boolean values are stored as "1" for `true` and
  * as "0" for `false`.
  *
  * @param  string $cookieName The cookie's name.
  * @param  mixed $value The cookie's value. This can be a string, a `bool`, an `int`, a `float`, an array, or a
  * map.
  */
 public function __construct($cookieName, $value)
 {
     assert('is_cstring($cookieName) && (is_cstring($value) || is_bool($value) || is_int($value) || ' . 'is_float($value) || is_collection($value))', vs(isset($this), get_defined_vars()));
     $this->m_name = $cookieName;
     if (is_cstring($value)) {
         $this->m_value = $value;
     } else {
         if (is_bool($value)) {
             $this->m_value = CString::fromBool10($value);
         } else {
             if (is_int($value)) {
                 $this->m_value = CString::fromInt($value);
             } else {
                 if (is_float($value)) {
                     $this->m_value = CString::fromFloat($value);
                 } else {
                     $json = new CJson($value);
                     $this->m_value = $json->encode();
                 }
             }
         }
     }
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:34,代码来源:CCookie.php

示例2: join

 /**
  * Joins the elements of an array into a string.
  *
  * The elements in the source array are not required to be all strings and, in addition to types that know how to
  * become a string, an element can be `int`, `float`, or `bool`. In the resulting string, a boolean value of
  * `true` becomes "1" and `false` becomes "0".
  *
  * As a special case, the array is allowed to be empty.
  *
  * @param  array $array The array containing the elements to be joined.
  * @param  string $binder The string to be put between any two elements in the resulting string, such as ", ".
  * Can be empty.
  *
  * @return string The resulting string.
  */
 public static function join($array, $binder)
 {
     assert('is_carray($array) && is_cstring($binder)', vs(isset($this), get_defined_vars()));
     $array = splarray($array);
     $array = self::makeCopy($array);
     for ($i = 0; $i < $array->getSize(); $i++) {
         if (!is_cstring($array[$i])) {
             if (is_bool($array[$i])) {
                 $array[$i] = CString::fromBool10($array[$i]);
             } else {
                 if (is_int($array[$i])) {
                     $array[$i] = CString::fromInt($array[$i]);
                 } else {
                     if (is_float($array[$i])) {
                         $array[$i] = CString::fromFloat($array[$i]);
                     }
                 }
             }
         }
     }
     return implode($binder, self::toPArray($array));
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:37,代码来源:CArray.php

示例3: setConfigOptionBool

 /**
  * Sets the value of a PHP's configuration option to a boolean value.
  *
  * @param  string $optionName The name of the option.
  * @param  bool $optionValue The option's new value.
  *
  * @return void
  */
 public static function setConfigOptionBool($optionName, $optionValue)
 {
     assert('is_cstring($optionName) && is_bool($optionValue)', vs(isset($this), get_defined_vars()));
     self::setConfigOption($optionName, CString::fromBool10($optionValue));
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:13,代码来源:CSystem.php

示例4: recurseQueryValueBeforeComposingQs

 protected static function recurseQueryValueBeforeComposingQs($value, $currDepth)
 {
     if ($currDepth == self::$ms_maxRecursionDepth) {
         return $value;
     }
     $currDepth++;
     if (!is_collection($value)) {
         if (!is_cstring($value)) {
             if (is_bool($value)) {
                 $value = CString::fromBool10($value);
             } else {
                 if (is_int($value)) {
                     $value = CString::fromInt($value);
                 } else {
                     if (is_float($value)) {
                         $value = CString::fromFloat($value);
                     } else {
                         assert('false', vs(isset($this), get_defined_vars()));
                     }
                 }
             }
         }
         return $value;
     }
     if (is_carray($value)) {
         $value = splarray($value)->toArray();
     } else {
         $value = parray($value);
     }
     foreach ($value as &$mapValue) {
         $mapValue = self::recurseQueryValueBeforeComposingQs($mapValue, $currDepth);
     }
     unset($mapValue);
     return $value;
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:35,代码来源:CUrlQuery.php

示例5: collectionElementToString

 protected static function collectionElementToString($elementValue, &$success)
 {
     if (is_cstring($elementValue)) {
         return $elementValue;
     }
     if (is_bool($elementValue)) {
         return CString::fromBool10($elementValue);
     }
     if (is_int($elementValue)) {
         return CString::fromInt($elementValue);
     }
     if (is_float($elementValue)) {
         return CString::fromFloat($elementValue);
     }
     $success = false;
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:16,代码来源:CInputFilter.php


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