刚才配置了数据库链接代码之后发现怎么也连不上,是因为有两个文件 .env和.envexample文件,注意配置参数要在.env文件里面,比如我用mysql的话配置.env里

这么一段:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=8889
DB_DATABASE=shop
DB_USERNAME= root
DB_PASSWORD=123456

然后在Controller里这么查询即可:

function test(){

  $card = DB::select("select * from card");
  dd($card);

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2021-06-04
  • 2021-09-22
  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2021-09-22
  • 2021-10-13
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案