PHP mysqli_ssl_set() 函數(shù)
實(shí)例
創(chuàng)建 SSL 連接:
?php
$con=mysqli_init();
if (!$con)
{
die("mysqli_init failed");
}
mysqli_ssl_set($con,"key.pem","cert.pem","cacert.pem",NULL,NULL);
if (!mysqli_real_connect($con,"localhost","my_user","my_password","my_db"))
{
die("Connect Error: " . mysqli_connect_error());
}
// 一些查詢...
mysqli_close($con);
?>
定義和用法
mysqli_ssl_set()
函數(shù)用于創(chuàng)建 SSL 安全連接。然而,該函數(shù)只有在啟用 OpenSSL 支持時(shí)才有效。
注釋:該函數(shù)必須在 mysqli_real_connect()
之前調(diào)用。
注釋:在 PHP 5.3.3 之前的版本,MySQL Native Driver 不支持 SSL。自 PHP 5.3+ 起,在微軟 Windows 上默認(rèn)啟用 MySQL Native Driver。
![](http://img.jbzj.com/file_images/article/201901/2019123171128459.png?2019023171141)
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接
您可能感興趣的文章:- PHP的PDO大對(duì)象(LOBs)
- PHP的PDO錯(cuò)誤與錯(cuò)誤處理
- PHP的PDO預(yù)處理語(yǔ)句與存儲(chǔ)過(guò)程
- PHP的PDO事務(wù)與自動(dòng)提交
- PHP的PDO預(yù)定義常量講解
- PHP的mysqli_thread_id()函數(shù)講解
- PHP的mysqli_stmt_init()函數(shù)講解
- PHP的mysqli_sqlstate()函數(shù)講解
- PDO::inTransaction講解
- PDO::lastInsertId講解