美文网首页
thinkphp连接数据库

thinkphp连接数据库

作者: 奔跑的兔子_ | 来源:发表于2018-04-28 16:38 被阅读0次
    目录 配置

    注意是:mysqli!版本高了,原来的MySQL连接将要过时了,要使用mysqli来连接,而且这个问题只会提示MySQL连接有错误。

    查询

        常见用法
         $data = $User->table('student_info')->select();
         $data = $User->table('score_list')->where('stu_id='.$stu_id)->select();
         $data = $User->table('student_info')->field(stu_name)->select();
    

    注意:select()是返回二维数组,find()是返回一维数组!用find只会返回一条数据
    field:过滤掉别的数据只显示stu_name

    在使用时注意连接数据库要在调用一个模块下去调这些方法

    相关文章

      网友评论

          本文标题:thinkphp连接数据库

          本文链接:https://www.haomeiwen.com/subject/ctnglftx.html