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


PHP is_not_null函数代码示例

本文整理汇总了PHP中is_not_null函数的典型用法代码示例。如果您正苦于以下问题:PHP is_not_null函数的具体用法?PHP is_not_null怎么用?PHP is_not_null使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: array

     $intro = '';
 }
 if (empty($ur_here)) {
     $ur_here = $_LANG['search_goods'];
 }
 /*------------------------------------------------------ */
 //-- 属性检索
 /*------------------------------------------------------ */
 $attr_in = '';
 $attr_num = 0;
 $attr_url = '';
 $attr_arg = array();
 if (!empty($_REQUEST['attr'])) {
     $sql = "SELECT goods_id, COUNT(*) AS num FROM " . $ecs->table("goods_attr") . " WHERE 0 ";
     foreach ($_REQUEST['attr'] as $key => $val) {
         if (is_not_null($val)) {
             $attr_num++;
             $sql .= " OR (1 ";
             if (is_array($val)) {
                 $sql .= " AND attr_id = '{$key}'";
                 if (!empty($val['from'])) {
                     $sql .= is_numeric($val['from']) ? " AND attr_value >= " . floatval($val['from']) : " AND attr_value >= '{$val['from']}'";
                     $attr_arg["attr[{$key}][from]"] = $val['from'];
                     $attr_url .= "&attr[{$key}][from]={$val['from']}";
                 }
                 if (!empty($val['to'])) {
                     $sql .= is_numeric($val['to']) ? " AND attr_value <= " . floatval($val['to']) : " AND attr_value <= '{$val['to']}'";
                     $attr_arg["attr[{$key}][to]"] = $val['to'];
                     $attr_url .= "&amp;attr[{$key}][to]={$val['to']}";
                 }
             } else {
开发者ID:a494008974,项目名称:bzbshop,代码行数:31,代码来源:search.php

示例2: array

     $intro = '';
 }
 if (empty($ur_here)) {
     $ur_here = $_LANG['search_goods'];
 }
 /*------------------------------------------------------ */
 //-- 属性检索
 /*------------------------------------------------------ */
 $attr_in = '';
 $attr_num = 0;
 $attr_url = '';
 $attr_arg = array();
 if (!empty($_REQUEST['attr'])) {
     $sql = "SELECT goods_id, COUNT(*) AS num FROM " . $ecs->table("goods_attr") . " WHERE 0 ";
     foreach ($_REQUEST['attr'] as $key => $val) {
         if (is_not_null($val) && is_numeric($key)) {
             $attr_num++;
             $sql .= " OR (1 ";
             if (is_array($val)) {
                 $sql .= " AND attr_id = '{$key}'";
                 if (!empty($val['from'])) {
                     $sql .= is_numeric($val['from']) ? " AND attr_value >= " . floatval($val['from']) : " AND attr_value >= '{$val['from']}'";
                     $attr_arg["attr[{$key}][from]"] = $val['from'];
                     $attr_url .= "&amp;attr[{$key}][from]={$val['from']}";
                 }
                 if (!empty($val['to'])) {
                     $sql .= is_numeric($val['to']) ? " AND attr_value <= " . floatval($val['to']) : " AND attr_value <= '{$val['to']}'";
                     $attr_arg["attr[{$key}][to]"] = $val['to'];
                     $attr_url .= "&amp;attr[{$key}][to]={$val['to']}";
                 }
             } else {
开发者ID:m7720647,项目名称:demo,代码行数:31,代码来源:search.php

示例3: elgg_format_attributes

/**
 * Converts an associative array into a string of well-formed attributes
 *
 * @note usually for HTML, but could be useful for XML too...
 *
 * @param array $attrs An associative array of attr => val pairs
 *
 * @return string HTML attributes to be inserted into a tag (e.g., <tag $attrs>)
 */
function elgg_format_attributes(array $attrs)
{
    $attrs = elgg_clean_vars($attrs);
    $attributes = array();
    if (isset($attrs['js'])) {
        //@todo deprecated notice?
        if (!empty($attrs['js'])) {
            $attributes[] = $attrs['js'];
        }
        unset($attrs['js']);
    }
    foreach ($attrs as $attr => $val) {
        $attr = strtolower($attr);
        if ($val === TRUE) {
            $val = $attr;
            //e.g. checked => TRUE ==> checked="checked"
        }
        // ignore $vars['entity'] => ElggEntity stuff
        if (is_not_null($val) && (is_array($val) || !is_object($var))) {
            // allow $vars['class'] => array('one', 'two');
            // @todo what about $vars['style']? Needs to be semi-colon separated...
            if (is_array($val)) {
                $val = implode(' ', $val);
            }
            $val = htmlspecialchars($val, ENT_QUOTES, 'UTF-8', false);
            $attributes[] = "{$attr}=\"{$val}\"";
        }
    }
    return implode(' ', $attributes);
}
开发者ID:rasul,项目名称:Elgg,代码行数:39,代码来源:output.php

示例4: ensure

function ensure($name, $value, $fn, $class = null, $method = null)
{
    if (!is_callable($fn)) {
        throw new InvalidArgumentException("#ensure: Given callback is not callable: " . sdump($fn));
    }
    if (!is_a_string($name)) {
        throw new InvalidArgumentException("#ensure: Given argument name is not a string: " . sdump($fn));
    }
    // TODO: Contract for $value
    if (is_not_null($class) && is_null($method)) {
        $method = $class;
        $class = null;
    }
    if (!$fn($value)) {
        throw new InvalidArgumentException("{$class}#{$method}: {$name} does not comply argument contract " . sdump($fn) . ": " . sdump($value) . ')');
    }
}
开发者ID:brainsware,项目名称:sauce,代码行数:17,代码来源:functions.php

示例5: build_message

 function build_message($params = '')
 {
     if ($params == '') {
         $params = array();
     }
     if (count($params) > 0) {
         reset($params);
         while (list($key, $value) = each($params)) {
             $this->build_params[$key] = $value;
         }
     }
     if (is_not_null($this->html_images)) {
         reset($this->html_images);
         while (list(, $value) = each($this->html_images)) {
             $this->html = str_replace($value['name'], 'cid:' . $value['cid'], $this->html);
         }
     }
     $null = NULL;
     $attachments = is_not_null($this->attachments) ? true : false;
     $html_images = is_not_null($this->html_images) ? true : false;
     $html = is_not_null($this->html) ? true : false;
     $text = is_not_null($this->text) ? true : false;
     switch (true) {
         case $text == true && $attachments == false:
             /* HPDL PHP3 */
             //          $message =& $this->add_text_part($null, $this->text);
             $message = $this->add_text_part($null, $this->text);
             break;
         case $text == false && $attachments == true && $html == false:
             /* HPDL PHP3 */
             //          $message =& $this->add_mixed_part();
             $message = $this->add_mixed_part();
             for ($i = 0; $i < count($this->attachments); $i++) {
                 $this->add_attachment_part($message, $this->attachments[$i]);
             }
             break;
         case $text == true && $attachments == true:
             /* HPDL PHP3 */
             //          $message =& $this->add_mixed_part();
             $message = $this->add_mixed_part();
             $this->add_text_part($message, $this->text);
             for ($i = 0; $i < count($this->attachments); $i++) {
                 $this->add_attachment_part($message, $this->attachments[$i]);
             }
             break;
         case $html == true && $attachments == false && $html_images == false:
             if (is_not_null($this->html_text)) {
                 /* HPDL PHP3 */
                 //            $message =& $this->add_alternative_part($null);
                 $message = $this->add_alternative_part($null);
                 $this->add_text_part($message, $this->html_text);
                 $this->add_html_part($message);
             } else {
                 /* HPDL PHP3 */
                 //            $message =& $this->add_html_part($null);
                 $message = $this->add_html_part($null);
             }
             break;
         case $html == true && $attachments == false && $html_images == true:
             if (is_not_null($this->html_text)) {
                 /* HPDL PHP3 */
                 //            $message =& $this->add_alternative_part($null);
                 $message = $this->add_alternative_part($null);
                 $this->add_text_part($message, $this->html_text);
                 /* HPDL PHP3 */
                 //            $related =& $this->add_related_part($message);
                 $related = $this->add_related_part($message);
             } else {
                 /* HPDL PHP3 */
                 //            $message =& $this->add_related_part($null);
                 //            $related =& $message;
                 $message = $this->add_related_part($null);
                 $related = $message;
             }
             $this->add_html_part($related);
             for ($i = 0; $i < count($this->html_images); $i++) {
                 $this->add_html_image_part($related, $this->html_images[$i]);
             }
             break;
         case $html == true && $attachments == true && $html_images == false:
             /* HPDL PHP3 */
             //          $message =& $this->add_mixed_part();
             $message = $this->add_mixed_part();
             if (is_not_null($this->html_text)) {
                 /* HPDL PHP3 */
                 //            $alt =& $this->add_alternative_part($message);
                 $alt = $this->add_alternative_part($message);
                 $this->add_text_part($alt, $this->html_text);
                 $this->add_html_part($alt);
             } else {
                 $this->add_html_part($message);
             }
             for ($i = 0; $i < count($this->attachments); $i++) {
                 $this->add_attachment_part($message, $this->attachments[$i]);
             }
             break;
         case $html == true && $attachments == true && $html_images == true:
             /* HPDL PHP3 */
             //          $message =& $this->add_mixed_part();
             $message = $this->add_mixed_part();
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:base-system,代码行数:101,代码来源:email.php

示例6: trimF

 public function trimF($characters = null)
 {
     if (is_not_null($characters)) {
         ensure('Argument', $characters, 'is_a_string', __CLASS__, __METHOD__);
     }
     if (null !== $characters) {
         $this->string = trim($this->string, $characters);
     } else {
         $this->string = trim($this->string);
     }
     return $this;
 }
开发者ID:brainsware,项目名称:sauce,代码行数:12,代码来源:SString.php


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