示例#1
0
文件: HModel.php 项目: HWeiXin/wx
 /**
  * 获取当前模型对应的表名
  * @param string $table
  * @return null|string
  */
 public function getTable($table = '')
 {
     if ($this->_table === null) {
         $config = H::getConfig('db');
         if ($table == '') {
             $class = get_called_class();
             $class_arr = array_filter(preg_split("/(?=[A-Z])/", $class));
             $table = implode('_', $class_arr);
             $table = $config['table_prefix'] . strtolower($table);
         }
         if ($this->_join) {
             $table .= ' as t';
         }
         $this->_table = $table;
     }
     return $this->_table;
 }
示例#2
0
文件: HPdo.php 项目: HWeiXin/wx
 public function __construct()
 {
     if ($this->_config === null) {
         $this->_config = H::getConfig('db');
     }
 }