mysql 开启ssl之后 ,项目如何连接数据库

 php mysqli 连接

        $servername = "";
        $username = "";
        $password = "";
        $db = mysqli_init();
        mysqli_options ($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);

        $db->ssl_set('', '', '', NULL, NULL);
        $link = mysqli_real_connect ($db, $servername, $username, $password, 'passplay', 3306, NULL, MYSQLI_CLIENT_SSL);
        if (!$link)
        {
            die ('Connect error (' . mysqli_connect_errno() . '): ' . mysqli_connect_error() . "
");
        } else {
            $res = mysqli_query($db,'select * from passplay_apply_info');
            $res =$res->fetch_all(MYSQLI_ASSOC);
            dump($res);
            $db->close();
        }
        // $data1->execute();
        // $ret = $data1->get_result();

        die;

tp3.2 的pdo连接

mysql 开启ssl之后 ,项目如何连接数据库_第1张图片

你可能感兴趣的:(日常笔记)