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


PHP Tool::setHtmlString方法代码示例

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


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

示例1: select

 protected function select(array $selectFields, array $param, $tables)
 {
     $limit = $order = $where = $fromTables = $like = '';
     $fields = implode(',', $selectFields);
     //处理筛选条件
     if (!Validate::isNullArray($param)) {
         $limit = isset($param['limit']) ? ' LIMIT  ' . $param['limit'] : '';
         $order = isset($param['order']) ? ' ORDER BY ' . $param['order'] : '';
         if (isset($param['where'])) {
             $isAnd = '';
             foreach ($param['where'] as $value) {
                 $isAnd .= $value . ' AND ';
             }
             $where = ' WHERE ' . substr($isAnd, 0, -4);
         }
         if (isset($param['like'])) {
             foreach ($param['like'] as $key => $value) {
                 $like = " WHERE {$key} LIKE '%{$value}%'";
             }
         }
     }
     //处理多表联查
     foreach ($tables as $value) {
         $fromTables .= $value . ' ,';
     }
     $fromTables = substr($fromTables, 0, -1);
     $sql = "SELECT {$fields} FROM {$fromTables} {$where} {$like} {$order} {$limit} ";
     $stmt = $this->execute($sql);
     $result = array();
     while (!!($obj = $stmt->fetchObject())) {
         $result[] = $obj;
     }
     return Tool::setHtmlString($result);
 }
开发者ID:zhendeguoke1008,项目名称:shop-1,代码行数:34,代码来源:DB.class.php

示例2: select

 protected function select($_tables, array $_field, array $_param = array())
 {
     $_limit = '';
     $_order = '';
     $_where = '';
     $_like = '';
     if (Validate::isArray($_param) && !Validate::isNullArray($_param)) {
         $_limit = isset($_param['limit']) ? 'LIMIT ' . $_param['limit'] : '';
         $_order = isset($_param['order']) ? 'ORDER BY ' . $_param['order'] : '';
         $_where = '';
         if (isset($_param['where'])) {
             foreach ($_param['where'] as $_key => $_value) {
                 $_where .= $_value . ' AND ';
             }
             $_where = 'WHERE ' . substr($_where, 0, -4);
         }
         if (isset($_param['like'])) {
             foreach ($_param['like'] as $_key => $_value) {
                 $_like = "WHERE {$_key} LIKE '%{$_value}%'";
             }
         }
     }
     $_selectFields = implode(',', $_field);
     $_table = isset($_tables[1]) ? $_tables[0] . ',' . $_tables[1] : $_tables[0];
     $_sql = "SELECT {$_selectFields} FROM {$_table} {$_where} {$_like} {$_order} {$_limit} ";
     $_stmt = $this->execute($_sql);
     $_result = array();
     while (!!($_objs = $_stmt->fetchObject())) {
         $_result[] = $_objs;
     }
     return Tool::setHtmlString($_result);
 }
开发者ID:yjf0503,项目名称:Mall,代码行数:32,代码来源:DB.class.php


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