我正在尝试让 Sqlite3 在 laravel 上工作。
在一个简单的 PHP 文件中,它工作得很好!
<?php
$handle = new SQLite3("mydb.db");
?>
但是在 laravel 控制器的功能中,它严重失败。
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Contracts\Cookie\Factory;
class HomeController extends Controller
{
/*
|--------------------------------------------------------------------------
| Home Controller
|--------------------------------------------------------------------------
|
| This is the home - dasboard controller,
| where you land if you visit the site the first time
| ror are redirected from the login page.
|
*/
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('customauthorize');
}
public function Index(Request $request, Factory $cookie)
{
$handle = new SQLite3("mydb.db");
return view('welcome');
}
}
?>
它实际上甚至在我的 Sqlite3 对象上呈现了一条波浪线。
Class 'App\Http\Controllers\SQLite3' not found
为什么会这样?