欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2024-03-05 23:40:19
如何判断php mysqli扩展类是否开启 php判断mysqli扩展类是否开启,源码如下:

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

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

<?php
 /* by http://www.manongjc.com/article/1206.html */
 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>";
 }
?>

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