Server : nginx/1.22.1 System : Linux iZwz9daxib3w3i063fw434Z 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 User : www ( 1000) PHP Version : 5.6.40 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv Directory : /www/wwwroot/www.jkmold.com/phpcms/model/ |
<?php defined('IN_PHPCMS') or exit('No permission resources.'); pc_base::load_sys_class('model', '', 0); class sitemodel_model extends model { public $table_name = ''; public function __construct() { $this->db_config = pc_base::load_config('database'); $this->db_setting = 'default'; $this->table_name = 'model'; parent::__construct(); $this->charset = $this->db_config[$this->db_setting]['charset']; } public function sql_execute($sql) { $sqls = $this->sql_split($sql); if(is_array($sqls)) { foreach($sqls as $sql) { if(trim($sql) != '') { $this->db->query($sql); } } } else { $this->db->query($sqls); } return true; } public function sql_split($sql) { global $db; if($this->db->version() > '4.1' && $this->charset) { $sql = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=".$this->charset,$sql); } if($this->db_tablepre != "phpcms_") $sql = str_replace("phpcms_", $this->db_tablepre, $sql); $sql = str_replace("\r", "\n", $sql); $ret = array(); $num = 0; $queriesarray = explode(";\n", trim($sql)); unset($sql); foreach($queriesarray as $query) { $ret[$num] = ''; $queries = explode("\n", trim($query)); $queries = array_filter($queries); foreach($queries as $query) { $str1 = substr($query, 0, 1); if($str1 != '#' && $str1 != '-') $ret[$num] .= $query; } $num++; } return($ret); } /** * 删除表 * */ public function drop_table($tablename) { $tablename = $this->db_tablepre.$tablename; $tablearr = $this->db->list_tables(); if(in_array($tablename, $tablearr)) { return $this->db->query("DROP TABLE $tablename"); } else { return false; } } /** * 修改member表会员模型 * @param unknown_type $tablename */ public function change_member_modelid($from_modelid, $to_modelid) { $tablename = $this->db_tablepre.'member'; $this->db->update(array('modelid'=>$to_modelid), $tablename, "modelid='$from_modelid'"); } } ?>