当前位置: 首页>>代码示例>>PHP>>正文


PHP MySQLi::close方法代码示例

本文整理汇总了PHP中MySQLi::close方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQLi::close方法的具体用法?PHP MySQLi::close怎么用?PHP MySQLi::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySQLi的用法示例。


在下文中一共展示了MySQLi::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: disconnect

 public function disconnect()
 {
     Logger::getInstance()->log('Disconnecting database.');
     if (isset($this->connection)) {
         $this->connection->close();
     }
     $this->connection = null;
 }
开发者ID:catlabinteractive,项目名称:neuron,代码行数:8,代码来源:MySQL.php

示例2: close

 /**
  * Fecha a conexão com o banco de dados.
  *
  * @return void
  */
 public function close()
 {
     if ($this->isConnected()) {
         $this->connection->close();
         unset($this->connection);
         $this->connection = null;
     }
 }
开发者ID:hbarcelos,项目名称:iMasters-Articles-Sources,代码行数:13,代码来源:Driver.php

示例3: _validateMysqli

 private function _validateMysqli($data)
 {
     $conn = new \MySQLi($data['db_hostname'], $data['db_username'], $data['db_password']);
     if ($conn->connect_error) {
         $conn->close();
         return false;
     } else {
         // Try to create database, if doesn't exist
         $sql = "CREATE DATABASE IF NOT EXISTS " . $data['db_database'];
         if ($conn->query($sql) === false) {
             // Couldn't create it, just check if exists
             $sql = "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '" . $data['db_database'] . "'";
             if (!$conn->query($sql)->num_rows) {
                 $conn->close();
                 return false;
             }
         }
         $conn->close();
         return true;
     }
 }
开发者ID:Hellysonrp,项目名称:arastta,代码行数:21,代码来源:database.php

示例4: close

 /**
  * Closes the connection to SphinxQL
  */
 public function close()
 {
     $result = $this->_driver->close();
     return $result;
 }
开发者ID:theratg,项目名称:miaox,代码行数:8,代码来源:Connection.class.php

示例5: close

 /**
  * Closes the database connection.
  */
 public function close()
 {
     $this->_mysqli->close();
 }
开发者ID:laiello,项目名称:crindigan,代码行数:7,代码来源:Database.php

示例6: die

if ($len < 102400 || $len > 5 * 1024 * 1024) {
    die("Pic size error! Allow size: 100KB to 5MB");
}
$ip = substr($_SERVER['REMOTE_ADDR'], 0, 49);
$pic = base64_decode($pic_str);
unset($pic_str);
$name = date('YmdHis', time());
$dir = 'img/' . date('Y/m/d', time());
$url = $dir . '/' . substr($name, 8) . '_' . uniqid() . '.png';
$sql = "insert into p(ip,name,url,rotate) values(?,?,?,0)";
$con = new MySQLi(DB_HOST, DB_NAME, DB_USER, DB_PASS);
$res = $con->prepare($sql);
$res->bind_param("sss", $ip, $name, $url);
$res->execute();
$res->close();
$con->close();
if (!is_dir($dir)) {
    mkdir($dir, 0755, true);
}
$file = fopen($url, "wb");
fwrite($file, $pic);
fflush($file);
fclose($file);
$img = imagecreatefromstring($pic);
unset($pic);
$width = imagesx($img);
$height = imagesy($img);
$ratio = $height > $width ? 800 / $height : 800 / $width;
$resize_img = imagecreatetruecolor($width * $ratio, $height * $ratio);
imagecopyresampled($resize_img, $img, 0, 0, 0, 0, $width * $ratio, $height * $ratio, $width, $height);
imagejpeg($resize_img, $url . "rs");
开发者ID:jjling2011,项目名称:sams,代码行数:31,代码来源:rec.php

示例7: array

//数据库类型
$host = 'localhost';
//数据库主机名
$user = 'root';
//数据库连接用户名
$pass = 'blog.benhuang1024.com';
$rpfield = 'body';
// update table char
$tostring = '';
//
$sql_arr = array(table1, table2);
$rpstring_arr = array('违规词1', '违规词2');
foreach ($rpstring_arr as $rpstring_one) {
    $rpstring = $rpstring_one;
    foreach ($sql_arr as $sql_one) {
        $mysqli = new MySQLi($host, $user, $pass, $sql_one);
        $mysqli->query("set names UTF8");
        $exptable_obj = $mysqli->query("show tables like '%_addonarticle'");
        // 获取表(内容表,标签表)
        $exptable = mysqli_fetch_array($exptable_obj);
        $exptable = $exptable[0];
        $rs = $mysqli->query("UPDATE {$exptable} SET {$rpfield}=REPLACE({$rpfield},'{$rpstring}','{$tostring}')");
        $mysqli->query("OPTIMIZE TABLE `{$exptable}`");
        if ($rs) {
            echo $sql_one . "成功完成&nbsp;" . $rpstring . "&nbsp;数据替换!<br />";
        } else {
            echo $sql_one . "中数据&nbsp;" . $rpstring . "&nbsp;替换失败!<br />";
        }
        $mysqli->close();
    }
}
开发者ID:benhuang1024,项目名称:phpTool,代码行数:31,代码来源:upd_table_char.php

示例8: add_user

function add_user($Uname, $Upass, $Urole)
{
    try {
        $host = "localhost";
        $user = "root";
        $pwd = "root";
        $db = "adminp";
        $con = new MySQLi($host, $user, $pwd);
        $con->select_db($db);
        $Uname1 = $Uname;
        $Uname = hash('md5', $Uname);
        $Upass = hash('md5', $Upass);
        $query = "insert into admin_users (u_name,u_pwd,u_role) values('" . $Uname . "','" . $Upass . "','" . $Urole . "')";
        if ($con->query($query)) {
            ?>
<div class="alert alert-success fade in" style="text-align:left;"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Success !</strong>Admin User is Added. USER :<?php 
            echo $Uname1;
            ?>
</div>
<?php 
        } else {
            ?>
<div class="alert alert-danger fade in" style="text-align:left;"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Unsuccess !</strong>User already EXISTS</div>
<?php 
        }
    } catch (Exception $ex) {
        print "{$ex}";
    }
    $con->close();
}
开发者ID:ronakjain2012,项目名称:TH,代码行数:30,代码来源:dashboard.php

示例9: __destruct

 /**
  * Destructor, disconnect from database
  */
 public function __destruct()
 {
     @$this->dbcon->close();
 }
开发者ID:pwodaniilea,项目名称:t3x-contexts_wurfl,代码行数:7,代码来源:TeraWurflDatabase_MySQL4.php

示例10:

            $t = preg_split("/(?<=\\w)\\b\\s*/", $row["time"]);
            echo "Posted Date : ";
            echo $t[0];
            echo $t[1];
            echo $t[2];
            echo "<br><br>";
            echo "Posted Time : ";
            echo $t[3];
            echo $t[4];
            echo $t[5];
            echo "<br><br>";
        }
    } else {
        echo " Sorry, No jobs your searched area. ";
    }
    $conn->close();
    //echo "Successfully";
}
?>


</center>
</div>
    </form>
    
    
    </div>
</div>
</div>
</body>
</html>
开发者ID:baaslk,项目名称:baas.lk,代码行数:31,代码来源:findjob.php

示例11: db_connect

    /**
     * Database connection
     *
     * @param	bool	$persistent
     * @return	object
     */
    public function db_connect($persistent = FALSE)
    {
        // Do we have a socket path?
        if ($this->hostname[0] === '/') {
            $hostname = NULL;
            $port = NULL;
            $socket = $this->hostname;
        } else {
            // Persistent connection support was added in PHP 5.3.0
            $hostname = $persistent === TRUE && is_php('5.3') ? 'p:' . $this->hostname : $this->hostname;
            $port = empty($this->port) ? NULL : $this->port;
            $socket = NULL;
        }
        $client_flags = $this->compress === TRUE ? MYSQLI_CLIENT_COMPRESS : 0;
        $this->_mysqli = mysqli_init();
        $this->_mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 10);
        if (isset($this->stricton)) {
            if ($this->stricton) {
                $this->_mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
            } else {
                $this->_mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode =
					REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
					@@sql_mode,
					"STRICT_ALL_TABLES,", ""),
					",STRICT_ALL_TABLES", ""),
					"STRICT_ALL_TABLES", ""),
					"STRICT_TRANS_TABLES,", ""),
					",STRICT_TRANS_TABLES", ""),
					"STRICT_TRANS_TABLES", "")');
            }
        }
        if (is_array($this->encrypt)) {
            $ssl = array();
            empty($this->encrypt['ssl_key']) or $ssl['key'] = $this->encrypt['ssl_key'];
            empty($this->encrypt['ssl_cert']) or $ssl['cert'] = $this->encrypt['ssl_cert'];
            empty($this->encrypt['ssl_ca']) or $ssl['ca'] = $this->encrypt['ssl_ca'];
            empty($this->encrypt['ssl_capath']) or $ssl['capath'] = $this->encrypt['ssl_capath'];
            empty($this->encrypt['ssl_cipher']) or $ssl['cipher'] = $this->encrypt['ssl_cipher'];
            if (!empty($ssl)) {
                if (isset($this->encrypt['ssl_verify'])) {
                    if ($this->encrypt['ssl_verify']) {
                        defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE);
                    } elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT')) {
                        $this->_mysqli->options(MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT, TRUE);
                    }
                }
                $client_flags |= MYSQLI_CLIENT_SSL;
                $this->_mysqli->ssl_set(isset($ssl['key']) ? $ssl['key'] : NULL, isset($ssl['cert']) ? $ssl['cert'] : NULL, isset($ssl['ca']) ? $ssl['ca'] : NULL, isset($ssl['capath']) ? $ssl['capath'] : NULL, isset($ssl['cipher']) ? $ssl['cipher'] : NULL);
            }
        }
        if (@$this->_mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags)) {
            // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails
            if ($client_flags & MYSQLI_CLIENT_SSL && version_compare($this->_mysqli->client_info, '5.7.3', '<=') && empty($this->_mysqli->query("SHOW STATUS LIKE 'ssl_cipher'")->fetch_object()->Value)) {
                $this->_mysqli->close();
                $message = 'MySQLi was configured for an SSL connection, but got an unencrypted connection instead!';
                log_message('error', $message);
                return $this->db->db_debug ? $this->db->display_error($message, '', TRUE) : FALSE;
            }
            return $this->_mysqli;
        }
        return FALSE;
    }
开发者ID:tastyigniter,项目名称:tastyigniter,代码行数:68,代码来源:mysqli_driver.php

示例12:

 function __destruct()
 {
     //		mysqli_report(MYSQLI_REPORT_OFF);
     parent::close();
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:5,代码来源:mysqli.php

示例13: json_encode

        } else {
            $slug = preg_replace('/[^a-z0-9]/si', '', $slug);
            if (is_numeric($slug) && strlen($slug) > 8) {
                $url = 'https://twitter.com/' . TWITTER_USERNAME . '/status/' . $slug;
            } else {
                $db = new MySQLi(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
                $db->set_charset('utf8mb4');
                $escapedSlug = $db->real_escape_string($slug);
                $redirectResult = $db->query('SELECT url FROM redirect WHERE slug = "' . $escapedSlug . '"');
                if ($redirectResult && $redirectResult->num_rows > 0) {
                    $db->query('UPDATE redirect SET hits = hits + 1 WHERE slug = "' . $escapedSlug . '"');
                    $url = $redirectResult->fetch_object()->url;
                } else {
                    $url = DEFAULT_URL . $_SERVER['REQUEST_URI'];
                }
                $db->close();
            }
        }
    }
}
header('Location: ' . $url, null, 301);
$attributeValue = htmlspecialchars($url);
?>
<meta http-equiv=refresh content="0;URL=<?php 
echo $attributeValue;
?>
"><a href="<?php 
echo $attributeValue;
?>
">Continue</a><script>location.href=<?php 
echo json_encode($url, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES);
开发者ID:abcselect,项目名称:php-url-shortener,代码行数:31,代码来源:index.php

示例14: MySQLi

<?php
$conn1=new MySQLi("localhost","user","password","database");
if($conn1->connect_errno){
    echo mysqli_connect_error();
    exit;
}
$res=$conn1->query("show tables") or die($conn1->error);
while($tables=$res->fetch_array()){
    $conn1->query("ALTER TABLE $tables[0] CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci") or die($conn1->error);
}
echo "The collation of your database has been successfully changed!";

$res->free();
$conn1->close();

?>
开发者ID:arielrossanigo,项目名称:trabajo_final,代码行数:16,代码来源:PQ6A5zHd.PHP

示例15: AddSet

 private function AddSet()
 {
     if ($this->get_request_method() != "POST") {
         $this->response('', 406);
     }
     $action = $this->_request['Action'];
     $query = "";
     $setName = $this->_request['Name'];
     $setNumber = $this->_request['Number'];
     $revision = $this->_request['Revision'];
     $universal = $setNumber . "-" . $revision;
     $pieces = $this->_request['Pieces'];
     $theme = $this->_request['Theme'];
     $subtheme = $this->_request['Subtheme'];
     $wptag = $this->_request['Tag'];
     $image = $this->_request['Image'];
     $released = $this->_request['Start'];
     $retired = $this->_request['End'];
     $description = $this->_request['Description'];
     $stub = $this->stubify($setName);
     if ($released == '') {
         $released = null;
     }
     if ($retired == '') {
         $retired = null;
     }
     $mysqli = new MySQLi(self::DB_SERVER, self::DB_USER, self::DB_PASSWORD, self::DB);
     if ($action == "new") {
         // $query = $mysqli->prepare("INSERT into test_setguide_main
         // set_number,revision,set_name,set_stub,theme_id,subtheme_id,pieces,
         // root_image,date_released,date_retired,wordpress_tag)
         // values(?,?,?,?,?,?,?,?,?,?,?)");
         // $query->bind_param('iisssiiisiis',$number,$revision,$name,$stub,$theme,$subtheme,
         // $pieces,$image,$released,$retired,$wptag);
         $query = $mysqli->prepare("INSERT into test_setguide_main \r\n\t\t\t\t\t(set_number,set_name,theme_id,subtheme_id,pieces,root_image,revision,\r\n\t\t\t\t\tset_stub,date_released,date_retired,wordpress_tag,universal_id,`description`) \r\n\t\t\t\t\tvalues(?,?,?,?,?,?,?,?,?,?,?,?,?)");
         $query->bind_param('isiiisisiisss', $setNumber, $setName, $theme, $subtheme, $pieces, $image, $revision, $stub, $released, $retired, $wptag, $universal, $description);
     } else {
         $query = $mysqli->prepare("UPDATE test_setguide_main SET \r\n\t\t\t\t\tset_name=?,theme_id=?,subtheme_id=?,pieces=?,\r\n\t\t\t\t\troot_image=?,revision=?,set_stub=?,date_released=?,date_retired=?,\r\n\t\t\t\t\twordpress_tag=?,universal_id=?,`description`=? \r\n\t\t\t\t\tWHERE  set_number=" . $setNumber);
         $query->bind_param('siiisisiisss', $setName, $theme, $subtheme, $pieces, $image, $revision, $stub, $released, $retired, $wptag, $universal, $description);
     }
     $query->execute();
     $mysqli->close();
     $this->response('', 200);
 }
开发者ID:yesonions,项目名称:fbtb,代码行数:44,代码来源:setguideapi.php


注:本文中的MySQLi::close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。