如何判断php mysqli扩展类是否开启

时间:2022-11-20 23:15:04

如何判断php mysqli扩展类是否开启

php判断mysqli扩展类是否开启,源码如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
 /* by http://www.zzvips.com/ */
 function mysqlinstalled (){
  if (function_exists ("mysql_connect")){
   return true;
  } else {
   return false;
  }
 }
 function mysqliinstalled (){
  if (function_exists ("mysqli_connect")){
   return true;
  } else {
   return false;
  }
 }
 
 if (mysqlinstalled()){
  echo "<p>The mysql extension is installed.</p>";
 } else {
  echo "<p>The mysql extension is not installed..</p>";
 }
 if (mysqliinstalled()){
  echo "<p>The mysqli extension is installed.</p>";
 } else {
  echo "<p>The mysqli extension is not installed..</p>";
 }
?>

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!