How can I check if sqlite2 is installed? Is it relatively easy?

Is it as simple as a 1 line check?

有帮助吗?

解决方案

You can check with this code:

$sqlite = extension_loaded('sqlite');
if ($sqlite)
{
    echo 'SQLITE IS INSTALLED';
}

You can also check which version is installed:

$sqlite2 = extension_loaded('sqlite2');
$sqlite3 = extension_loaded('sqlite3');
if ($sqlite2 || $sqlite3)
{
    if ($sqlite2)
    {
     echo 'SQLITE2 IS INSTALLED';
    }

    if ($sqlite3)
    {
     echo 'SQLITE3 IS INSTALLED';
    }
} else
{
  echo 'SQL IS NOT INSTALLED';
}

其他提示

if(extension_loaded('sqlite')) {
  [ .... ]
}

If the sqlite extension is available, then you can proceed using it as you wish.

See also: http://php.net/extension_loaded

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top