PHP handleiding

PHP TUIS PHP Inleiding PHP installeer PHP sintaksis PHP opmerkings PHP veranderlikes PHP Echo / Druk PHP datatipes PHP Strings PHP-nommers PHP Wiskunde PHP konstante PHP-operateurs PHP As...Anders...Elseif PHP skakelaar PHP-lusse PHP funksies PHP-skikkings PHP Superglobals PHP RegEx

PHP- vorms

PHP-vormhantering PHP-vorm validering PHP-vorm word vereis PHP-vorm URL/e-pos PHP-vorm voltooi

PHP Gevorderd

PHP datum en tyd PHP sluit in PHP-lêerhantering PHP-lêer oop/lees PHP-lêer skep/skryf PHP-lêer oplaai PHP-koekies PHP-sessies PHP filters PHP-filters Gevorderd PHP-terugbelfunksies PHP JSON PHP-uitsonderings

PHP OOP

PHP Wat is OOP PHP Klasse/Objekte PHP Konstrukteur PHP vernietiger PHP Toegangswysigers PHP erfenis PHP konstante PHP Abstrakte Klasse PHP-koppelvlakke PHP eienskappe PHP statiese metodes PHP Statiese Eienskappe PHP naamruimtes PHP Iterables

MySQL- databasis

MySQL-databasis MySQL Connect MySQL Skep DB MySQL Skep tabel MySQL Voeg data in MySQL Kry Laaste ID MySQL Voeg veelvuldige in MySQL voorberei MySQL Kies Data MySQL Waar MySQL Bestel deur MySQL verwyder data MySQL-opdateringsdata MySQL-limietdata

PHP XML

PHP XML-ontleders PHP SimpleXML-ontleder PHP SimpleXML - Kry PHP XML Expat PHP XML DOM

PHP - AJAX

AJAX Intro AJAX PHP AJAX-databasis AJAX XML AJAX Live Search AJAX-peiling

PHP voorbeelde

PHP voorbeelde PHP samesteller PHP vasvra PHP Oefeninge PHP-sertifikaat

PHP- verwysing

PHP Oorsig PHP Skikking PHP-kalender PHP datum PHP gids PHP fout PHP-uitsondering PHP lêerstelsel PHP filter PHP FTP PHP JSON PHP sleutelwoorde PHP Libxml PHP-pos PHP Wiskunde PHP Diverse PHP MySQLi PHP-netwerk PHP-uitsetbeheer PHP RegEx PHP SimpleXML PHP-stroom PHP-string PHP veranderlike hantering PHP XML-ontleder PHP zip PHP Tydsones

PHP mysqli ssl_set() Funksie

❮ PHP MySQLi-verwysing

Voorbeeld - Objekgeoriënteerde styl

Skep 'n SSL-verbinding:

<?php
$mysqli = mysqli_init();
if (!$mysqli) {
  die("mysqli_init failed");
}

$mysqli -> ssl_set("key.pem", "cert.pem", "cacert.pem", NULL, NULL);

if (!$mysqli -> real_connect("localhost","my_user","my_password","my_db")) {
  die("Connect Error: " . mysqli_connect_error());
}

// Some queries...

$mysqli -> close();
?> 

Kyk na voorbeeld van prosedurele styl onderaan.


Definisie en gebruik

Die ssl_set() / mysqli_ssl_set() funksie word gebruik om veilige verbindings met behulp van SSL te vestig. Hierdie funksie doen egter niks tensy OpenSSL-ondersteuning geaktiveer is nie.

Let wel: Hierdie funksie moet geroep word voor real_connect() .

Let wel: MySQL Native Driver ondersteun nie SSL voor PHP 5.3.3 nie. MySQL Native Driver is by verstek geaktiveer op Microsoft Windows vanaf PHP 5.3+.


Sintaksis

Objekgeoriënteerde styl:

$mysqli -> ssl_set(key, cert, ca, capath, cipher)

Prosedure styl:

mysqli_ssl_set(connection, key, cert, ca, capath, cipher)

Parameterwaardes

Parameter Description
connection Required. Specifies the MySQL connection to use
key Required. Specifies the path name to the key file
cert Required. Specifies the path name to the certificate file
ca Required. Specifies the path name to the certificate authority file
capath Required. Specifies the pathname to a directory that contains trusted SSL CA certificates in PEM format
cipher Required. Specifies a list of allowable ciphers to use for SSL encryption

Tegniese besonderhede

Terugkeerwaarde: Altyd WAAR. As SSL-opstelling verkeerd is, sal real_connect() 'n fout terugstuur wanneer jy probeer koppel
PHP weergawe: 5+

Voorbeeld - Prosedurele styl

Skep 'n SSL-verbinding:

<?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());
}

// Some queries...

mysqli_close($con);
?>


❮ PHP MySQLi-verwysing