如何在 Laravel 5.2 框架中创建 sqlite 文件?

How to create sqlite file in Laravel 5.2 framework?

我想在用户注册时手动创建一个 Sqlite 文件。我用

new SQLite3($file_path)

但是Laravel继续告诉我

Class 'App\Http\Controllers\Sqlite3' not found

请帮我解决这个问题。非常感谢您的帮助。

你应该使用:

new \SQLite3($file_path)

或放

use SqlLite3;

低于

namespace App\Http\Controllers;

现在您正在尝试使用当前命名空间中的 SqLite3

您可能也有兴趣查看 How to use objects from other namespaces and how to import namespaces in PHP