Skip to content

Commit

Permalink
Sync mysqli_real_connect (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored Dec 25, 2023
1 parent eb1d405 commit 097303c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions reference/mysqli/mysqli/real-connect.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: ae0dfad417adaba25669003c69024aa96b71dddf Maintainer: 谢毅斌 Status: ready -->
<!-- EN-Revision: a2ef8f387d2264f26131c0a270f534141a68e18c Maintainer: 谢毅斌 Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="mysqli.real-connect" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down Expand Up @@ -43,8 +43,7 @@
<itemizedlist>
<listitem>
<para>
<function>mysqli_real_connect</function> 需要一个 <classname>mysqli</classname> 对象的实例。
这可以通过调用无参数的 <methodname>mysqli::__construct</methodname> 或 <function>mysqli_connect</function> 获得。
<function>mysqli_real_connect</function> 需要一个由 <function>mysqli_init</function> 创建的有效对象。
</para>
</listitem>
<listitem>
Expand Down Expand Up @@ -226,9 +225,9 @@
<![CDATA[
<?php
$mysqli = new mysqli();
$mysqli = mysqli_init();
if (!$mysqli) {
die('mysqli connection failed');
die('mysqli_init failed');
}
if (!$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
Expand Down Expand Up @@ -257,7 +256,6 @@ $mysqli->close();
class foo_mysqli extends mysqli {
public function __construct($host, $user, $pass, $db) {
// 必须直接调用父构造函数,否则将产生 E_FATAL 错误
parent::__construct();
if (!parent::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
Expand Down Expand Up @@ -288,9 +286,9 @@ $db->close();
<![CDATA[
<?php
$link = mysqli_connect();
$link = mysqli_init();
if (!$link) {
die('mysqli_connect failed');
die('mysqli_init failed');
}
if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
Expand Down Expand Up @@ -331,6 +329,7 @@ Success... MySQL host info: localhost via TCP/IP
<para>
<simplelist>
<member><function>mysqli_connect</function></member>
<member><function>mysqli_init</function></member>
<member><function>mysqli_options</function></member>
<member><function>mysqli_ssl_set</function></member>
<member><function>mysqli_close</function></member>
Expand Down

0 comments on commit 097303c

Please sign in to comment.