php连接mysql数据库

好像在7以上的版本mysql_connect()函数已经不用了
要使用 mysqli_connect()

<?php
    $conn=mysqli_connect("localhost","root","1234");
        if($conn){
            echo"ok";
        }else{
            echo"error";
        }
?>

连接出现问题

PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: C:\php\ext\curl (找不到指定的模块。), C:\php\ext\php_curl.dll (找不到指定的模块。)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'gd' (tried: C:\php\ext\gd (找不到指定的模块。), C:\php\ext\php_gd.dll (找不到指定的模块。)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: C:\php\ext\mbstring (找不到指定的模块。), C:\php\ext\php_mbstring.dll (找不到指定的模块。)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: C:\php\ext\mysqli (找不到指定的模块。), C:\php\ext\php_mysqli.dll (找不到指定的模块。)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: C:\php\ext\pdo_mysql (找不到指定的模块。), C:\php\ext\php_pdo_mysql.dll (找不到指定的模块。)) in Unknown on line 0 PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in在这里插入图片描述
解决办法:
在php.ini配置文件里搜索ctrl+f搜索 extension_dir=“ext”
在这里插入图片描述

去掉这一行前面的分号;
在这里插入图片描述在这里插入图片描述

然后保存。
测试:
连接成功
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值