<?php
//phpinfo();
/**
* Simple example of extending the SQLite3 class and changing the __construct
* parameters, then using the open method to initialize the DB.
*/
class MyDB extends SQLite3
{
function __construct()
{
$this->open('test.db');
}
}
$db = new MyDB();
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$result = $db->query('SELECT bar FROM foo');
var_dump($result->fetchArray());
?>运行的时候出现异常:Class 'SQLite3' not found in。。。。。。
需要在php.ini中修改下面的配置
extension_dir = "C:/php/php7.0/ext" extension=php_pdo_sqlite.dll extension=php_sqlite3.dll sqlite3.extension_dir = "C:/php/php7.0/ext"
本文介绍了一个使用PHP扩展SQLite3类的简单示例,演示了如何创建数据库表、插入数据及查询记录。解决类未找到的问题需要正确配置php.ini文件。
31万+

被折叠的 条评论
为什么被折叠?



