使用laravel的db插入数据

 

DB::table('tags')->insert(
    ['name'=>'test']
);

报错Class 'App\Http\Controllers\DB' not found and I also cannot use a new Model

解决方法:

在DB前面加个反斜杠

\DB::table('tags')->insert(
    ['name'=>'test']
);

 

相关文章:

  • 2021-10-11
  • 2021-10-03
  • 2021-05-25
  • 2021-04-17
  • 2021-10-09
  • 2021-06-26
  • 2022-01-09
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2021-09-24
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
相关资源
相似解决方案