如何判断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 "The mysql extension is installed.
";
} else {
echo "The mysql extension is not installed..
";
}
if (mysqliinstalled()){
echo "The mysqli extension is installed.
";
} else {
echo "The mysqli extension is not installed..
";
}
?>