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

? ??? ?? PHP ???? PHP PDO ?????? ?? ???

PHP PDO ?????? ?? ???

Jul 25, 2016 am 08:42 AM

複製程式碼

??? PDO ??? ??????. . ??? ??? ????

PdoDb ?????? ???

  1. /**
  2. * @throws ??
  3. * PDO ??????
  4. */
  5. PdoDb ???? DatabaseAbstract? ?????
  6. {
  7. /**
  8. * PDO ????
  9. * @var PDO
  10. */
  11. protected $DB;
  12. /**
  13. * PDO ???
  14. * @var PDOStatement
  15. */
  16. protected $Stmt;
  17. /**
  18. * ??? SQL ?
  19. * @var string
  20. */
  21. protected $Sql;
  22. /* *
  23. * ?? ?? $config=array('dsn'=>xxx,'name'=>xxx,'password'=>xxx,'option'=>xxx)
  24. * @var array
  25. */
  26. protected $Config;
  27. /**
  28. * ???
  29. * @param array $config
  30. */
  31. ?? ?? __construct($config)
  32. {
  33. $this->Config = $config;
  34. }
  35. /**
  36. * ??????? ??
  37. * @return void
  38. */
  39. ?? ?? connect()
  40. {
  41. $this->DB = new PDO($this- >Config['dsn'], $this->Config['name'], $this->Config['password'], $this->Config['option']);
  42. / /默認(rèn)把結(jié)果序列化成stdClass
  43. $this->DB->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
  44. //自己寫(xiě)代碼捕獲Exception
  45. $this-> DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
  46. }
  47. /**
  48. * ?? ??
  49. * @return void
  50. */
  51. ?? ?? disConnect()
  52. {
  53. $this->DB = null;
  54. $this->Stmt = null;
  55. }
  56. /**
  57. * sql? ???? ?? ??? id? ??
  58. * @param string $statement
  59. * @return string
  60. */
  61. ?? ?? exec($statement)
  62. {
  63. if ($this->DB->exec($statement)) {
  64. $this->Sql = $statement;
  65. return $this->lastId();
  66. }
  67. $this->errorMessage();
  68. }
  69. /**
  70. * 查詢sql
  71. * @param string $statement
  72. * @return PdoDb
  73. */
  74. ?? ?? ??($statement)
  75. {
  76. $res = $this->DB->query($statement);
  77. if ($res) {
  78. $this->Stmt = $res;
  79. $this->Sql = $statement;
  80. return $this;
  81. }
  82. $this->errorMessage();
  83. }
  84. /**
  85. * ???? ? ? ???
  86. * @return ??
  87. */
  88. ?? ?? fetchOne()
  89. {
  90. return $this->Stmt->fetch();
  91. }
  92. /**
  93. * ?? ??? ???
  94. * @return ??
  95. */
  96. ?? ?? fetchAll()
  97. {
  98. return $this->Stmt->fetchAll();
  99. }
  100. /**
  101. * ??? ?? ???
  102. * @return ???
  103. */
  104. ?? ?? lastId()
  105. {
  106. return $this->DB->lastInsertId();
  107. }
  108. /**
  109. * ??? ?? ? ?
  110. * @return int
  111. */
  112. ?? ??affectRows()
  113. {
  114. return $this->Stmt->rowCount();
  115. }
  116. /**
  117. * ??? ??
  118. * @param string $statement
  119. * @return PdoDb
  120. */
  121. ?? ?? prepare($statement)
  122. {
  123. $res = $this->DB->prepare($statement);
  124. if ($res) {
  125. $this->Stmt = $res;
  126. $this->Sql = $statement;
  127. return $this;
  128. }
  129. $this->errorMessage();
  130. }
  131. /**
  132. * ??? ???
  133. * @param array $array
  134. * @return PdoDb
  135. */
  136. ?? ?? binArray ($array)
  137. {
  138. foreach ($array as $k => $v) {
  139. if (is_array($v)) {
  140. //??? ?? array('value'=>xxx,'type'=>PDO::PARAM_XXX)
  141. $ this->Stmt->bindValue($k 1, $v['value'], $v['type']);
  142. } else {
  143. $this->Stmt->bindValue ($k 1, $v, PDO::PARAM_STR);
  144. }
  145. }
  146. return $this;
  147. }
  148. /**
  149. * ??? ?? ??
  150. * @return bool
  151. */
  152. ?? ?? ??()
  153. {
  154. if ($this->Stmt->execute()) {
  155. return true;
  156. }
  157. $this->errorMessage();
  158. }
  159. /**
  160. * ?? ??
  161. * @return bool
  162. */
  163. ?? ?? startTransaction()
  164. {
  165. return $this->DB->beginTransaction();
  166. }
  167. /**
  168. * ???? ??
  169. * @return bool
  170. */
  171. ?? ?? commitTransaction()
  172. {
  173. return $this->DB->commit();
  174. }
  175. /**
  176. * 回滾事務(wù)
  177. * @return bool
  178. */
  179. public function rollbackTransaction()
  180. {
  181. return $this->DB->rollBack();
  182. }
  183. /**
  184. * 拋出錯(cuò)誤
  185. * @throws Error
  186. * @return void
  187. */
  188. public function errorMessage()
  189. {
  190. $msg = $this->DB->errorInfo();
  191. throw new Error('資料庫(kù)錯(cuò)誤:' $msg[2]);
  192. }
  193. //---------------------
  194. /* *
  195. * 單例實(shí)例
  196. * @var PdoDb
  197. * /
  198. protected static $_instance;
  199. /**
  200. * 預(yù)設(shè)資料庫(kù)
  201. * @static
  202. * @param array $config
  203. * @return PdoDb
  204. */
  205. 公用靜態(tài)函式實(shí)例($config)
  206. {
  207. if (!self ::$_instance instanceof PdoDb) {
  208. self::$_instance = new PdoDb($config);
  209. self::$_instance->connect();
  210. }
  211. return self:: $_instance;
  212. }
  213. //------------------------
  214. /**
  215. * 取得PDO支援的資料庫(kù)
  216. * @static
  217. * @return array
  218. * /
  219. public static function getSupportDriver(){
  220. return PDO::getAvailableDrivers();
  221. }
  222. /**
  223. * 取得資料庫(kù)的版本資訊
  224. * @return array
  225. */
  226. public function getDriverVersion(){*/
  227. public function getDriverVersion(){ $
  228. public function getDriverVersion(){ $
  229. public function getDriverVersion(){ $ name = $name. ->DB->getAttribute(PDO::ATTR_DRIVER_NAME);
  230. 返回?cái)?shù)組($name=>$this->DB->getAttribute(PDO::ATTR_CLIENT_VERSION));
}
}

複製程式碼

使用的時(shí)候
PdoDb::instance($config);


PHP、PDO
? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? 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 11, 2025 am 03:12 AM

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

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

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

?? 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 12, 2025 am 03:15 AM

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

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

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

See all articles