国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? ??? ?? ??? ???? PHP? ??? MySQL ???

??? ?? ??? ???? PHP? ??? MySQL ???

Jul 25, 2016 am 08:56 AM

  1. /**

  2. * MySQL ??-?? ?? ???
  3. * $db_config = array(
  4. * 'master' => array('host'=>'localhost:3306','user'=>' admin ','passwd'=>'123456','db'=>'stat'),
  5. * 'slave' => array(
  6. * array('host'=>'localhost : 3307','user'=>'admin','passwd'=>'123456','db'=>'stat'),
  7. * array('host'=>'localhost: 3308 ','user'=>'admin','passwd'=>'123456','db'=>'stat')
  8. * )
  9. * );
  10. *
  11. * ??: ????? ?? ?? ?? ???? ?????
  12. * ?? ??: bbs.it-home.org
  13. */
  14. /*
  15. $db_config = ??(
  16. '???' => array('host'=>'localhost:3306','user'=>'admin','passwd'=>'123456','db'=>' stat'),
  17. '????' => array(
  18. array('host'=>'localhost:3307','user'=>'admin','passwd'=>'123456 ','db'=>'stat'),
  19. array('host'=>'localhost:3308','user'=>'admin','passwd'=>'123456', 'db'=>'stat')
  20. )
  21. );

  22. $db = MySQL::getInstance('','r-w');< ;/p>

  23. $sql = "????? * ??";

  24. $rs = $db->query($sql);

  25. while ($row = $db->fetch($rs)){
  26. echo "uid:".$row['uid']." ".$row['userName']."
    ";
  27. }

  28. echo "


    ";
  29. */

  30. class MySQL

  31. {
  32. private static $_instance = null;//數(shù)據(jù)庫連接實例
  33. private static $_master = null;//主數(shù)據(jù)庫連接實例
  34. private static $_slave = null;//??數(shù)據(jù)庫連接實
  35. public $_config = array();//數(shù)據(jù)庫連接配置信息
  36. public $_res = null;//查詢實例句柄
  37. public $_flag = '';//標(biāo)識當(dāng)前語句是主還是重數(shù)據(jù)庫上執(zhí)行
  38. public $_link = null;
  39. /**
  40. * 單實例
  41. * ??? ??? ?????...
  42. * @paramknown_type $dbname
  43. * @paramknown_type $mode
  44. */
  45. public static function & getInstance($dbname='',$mode='rw '){
  46. if (is_null(self::$_instance)){
  47. self::$_instance = new self();
  48. self::$_instance->__getConf();
  49. self::$_instance->connect($dbname,$mode);
  50. }
  51. return self::$_instance;
  52. }

  53. /**

  54. * ?????? ?? ?? ????
  55. * ??? ??? ?????...
  56. */
  57. ?? ?? __getConf(){
  58. ?? $db_config;
  59. $this->_config['master'] = $db_config['master'];
  60. $this->_config['slave'] = $db_config['slave'];
  61. }
  62. /**
  63. * ?????? ??
  64. * ??? ??? ?????...
  65. * @param $dbname? ??? ?????? ??? ????? ?????.
  66. * @param $mode rw? ?? ?? ?????? ???? r-w? ?? ? ?? ??? ?????
  67. */
  68. ?? ?? connect($dbname='' ,$mode = 'rw'){
  69. if($mode == 'rw'){
  70. if(is_null(self::$_master)){
  71. $this->_master = $this ->_slave = $this->conn_master($dbname);
  72. }
  73. }else{
  74. if(is_null(self::$_master)){
  75. $this->_master = $this->conn_master($dbname);
  76. }
  77. if(is_null(self::$_slave)){
  78. $this->_slave = $this->conn_slave($dbname );
  79. }
  80. }
  81. }
  82. /**
  83. * ?? ?????? ??? ??
  84. * ??? ??? ?????...
  85. */
  86. ?? ?? conn_master($dbname=''){
  87. $_link = mysql_connect( $this->_config['master']['host'],$this->_config['master']['user'],$this->_config['master']['passwd'] ,true) ?? ??("Connect ".$this->_config['master']['host']." ??.");
  88. mysql_select_db(empty($dbname)?$this->_config ['master']['db']:$dbname,$_link) ?? die(" DB ?? ".$this->_config['master']['db']."? ???? ????.") ;
  89. mysql_query("set names utf8",$_link);
  90. return $_link;
  91. }
  92. /**
  93. * ???? ?????? ??? ??
  94. * ??? ??? ?????...
  95. */
  96. ?? ?? conn_slave($dbname=''){
  97. $offset = rand(0,count($this->_config['slave') ])-1);
  98. $_link = @mysql_connect($this->_config['slave'][$offset]['host'],$this->_config['slave'][$offset ]['user'],$this->_config['slave'][$offset]['passwd'],true) ?? die(" ?? ".$this->_config['slave'][$ offset]['host']." ??.");
  99. mysql_select_db(empty($dbname)?$this->_config['slave'][$offset]['db']:$dbname,$ _link) ?? die(" DB ?? ".$this->_config['slave'][$offset]['db']."? ???? ????.");
  100. mysql_query("set names utf8" ,$_link);
  101. $_link ??
  102. }

  103. /**

  104. * ?????? ?? ??
  105. * ??? ??? ?????...
  106. * @param string $sql
  107. */
  108. ?? ?? ??($sql,$master=true){

  109. if($master == true || (substr(strtolower($sql),0,6) != 'select') && $master == false){

  110. $this->_res = mysql_query($sql ,$this->_master);
  111. if(!$this->_res){
  112. $this->_error[] = mysql_error($this->_master);
  113. }
  114. $this->_flag = '???';
  115. $this->_link = $this->_master;
  116. } else {
  117. $this->_res = mysql_query($sql ,$this->_slave);
  118. if(!$this->_res){
  119. $this->_error[] = mysql_error($this->_slave);
  120. }
  121. $this->_flag = 'slave';
  122. $this->_link = $this->_slave;
  123. }

  124. return $this->_res;

  125. }
  126. /**
  127. * ?? ??? ? ????
  128. * ??? ?? ?? ...
  129. * @param ?? $rs
  130. */
  131. ?? ?? get($rs=''){
  132. if(empty($rs) ){
  133. $rs = $this->_res;
  134. }
  135. return mysql_fetch_row($rs);
  136. }
  137. /**
  138. * ?? ? ??? ????
  139. * ??? ??? ????? ...
  140. * @param mix $rs
  141. * @param $result_type
  142. */
  143. ?? ?? fetch($rs = ''){
  144. if(empty($rs)){
  145. $rs = $this->_res;
  146. }
  147. return mysql_fetch_array($rs,MYSQL_ASSOC );
  148. }
  149. /**
  150. * ??? ??
  151. * ??? ??? ?????...
  152. * @paramknown_type $sql
  153. */
  154. ?? ?? add($sql){
  155. $rs = $this->query($sql);
  156. if($rs)
  157. return mysql_insert_id($this->_link);
  158. return false;
  159. }
  160. /**
  161. * ??? ????
  162. * ??? ??? ?????...
  163. * @paramknown_type $sql
  164. */
  165. ?? ?? ???? ($sql){
  166. if(empty($sql)) return false;
  167. $rs = $this->query($sql);
  168. if($rs)
  169. return $this ->fetchNum();
  170. return false;
  171. }

  172. /**

  173. * ?? ???? ??? ?? ? ? ????
  174. * ??? ?? ??...
  175. */
  176. ?? ?? fetchNum(){
  177. return mysql_affected_rows($this->_link);
  178. }
  179. /**
  180. * ???, ?????? ?? ??? ??
  181. * ??? ??? ?????...
  182. */
  183. ?? ?? __destruct(){
  184. mysql_close($this->_link);
  185. }
  186. }

復(fù)主代碼


? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
PHP ?? ??? ??????? PHP ?? ??? ??????? Jul 17, 2025 am 04:16 AM

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP?? ?? ???? ???? ???? ??? ?????? PHP?? ?? ???? ???? ???? ??? ?????? Jul 08, 2025 am 02:37 AM

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP?? ?? ?? PHP?? ?? ?? Jul 18, 2025 am 04:57 AM

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

PHP ?? ?? ? PHP ?? ?? ? Jul 18, 2025 am 04:51 AM

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

PHP?? ???? ??? ?????? PHP?? ???? ??? ?????? Jul 11, 2025 am 03:12 AM

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

?? PHP : ??? ??? ?? PHP : ??? ??? Jul 18, 2025 am 04:54 AM

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

?? PHP ?? ??? ?? PHP ?? ??? Jul 18, 2025 am 04:52 AM

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

PHP?? ??? ? ???? ??? ????? ?? PHP?? ??? ? ???? ??? ????? ?? Jul 12, 2025 am 03:15 AM

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

See all articles