### findAll
**從數據表中查找記錄**
**參數**
conditions : 查找條件,數組array("字段名"=>"查找值")或字符串,
請注意在使用字符串時請自行使用\_\_val\_escape來對輸入值進行過濾
sort: 排序,等同于“ORDER BY ”
fields: 返回的字段范圍,默認為返回全部字段的值
~~~
public function findAll($conditions = null, $sort = null, $fields = null, $limit = null) {
$where = "";
$fields = empty ( $fields ) ? "*" : $fields;
if (is_array ( $conditions )) {
$join = array ();
foreach ( $conditions as $key => $condition ) {
$condition = $this->__val_escape ( $condition );
$join [] = "{$key} = '{$condition}'";
}
$where = "WHERE " . join ( " AND ", $join );
} else {
if (null != $conditions)
$where = "WHERE " . $conditions;
}
if (null != $sort)
$sort = "ORDER BY {$sort}";
if (null != $limit)
$limit = "LIMIT {$limit}";
$sql = "SELECT {$this->tbl_name}.{$fields} FROM {$this->tbl_name} {$where} {$sort} {$limit}";
return $this->_db->getArray ( $sql );
}
~~~
- 架構
- 基礎框架文檔
- base/action(C層基類)
- protected 類定義
- __construct構造函數
- c_list
- c_index
- c_page
- c_pageJson
- c_listJson
- c_getByAjax
- c_getCountByName
- c_toAdd
- c_add
- c_init
- c_edit
- c_deletes
- c_ajaxdeletes
- c_saveBatch
- c_checkRepeat
- getDatadicts
- showDatadicts
- getDataNameByCode
- assign
- display
- view
- assignFunc
- model/base(M層基類)
- protected類定義(model)
- __construct
- find
- get_table_fields
- findAll
- findSql
- create
- delete
- findBy
- updateField
- query
- findCount
- update
- filterFunc
- filterField
- filterWithoutField
- filterCustom
- createBatch
- pageBySql
- listBySql
- pageBySqlId
- deletes
- 事務控制
- 獲取對象數組
- addBatch_d
- add_d
- edit_d
- isRepeat
- 列表組件文檔
- 基礎表格
- 數據獲取
- 表格數據顯示
- 常用控制參數
- 表格右鍵擴展
- 表格擴展按鈕
- 快速搜索
- 高級搜索(自定義視圖)
- 表格注冊事件
- 主從表格
- 可編輯表格
- 模塊開發
- 開發案例
- 開發準則