致命错误:在PHP中调用未定义的函数sqlite\u escape\u string()

致命错误:在PHP中调用未定义的函数sqlite\u escape\u string(),php,apache,sqlite,aes,Php,Apache,Sqlite,Aes,大家好,我需要PHP中SQLite-SQLite\u escape\u string()的帮助。 下面是一个代码: <?php require_once('AES/AES_Encryption.php'); require_once('AES/padCrypt.php'); $database = new PDO('sqlite:example_sqlite3.db'); $key = "bac09c63f34c9845c707228b20cac5e0"; $iv = "1234

大家好,我需要PHP中SQLite-SQLite\u escape\u string()的帮助。 下面是一个代码:

<?php
require_once('AES/AES_Encryption.php');
require_once('AES/padCrypt.php');

$database = new PDO('sqlite:example_sqlite3.db');

$key = "bac09c63f34c9845c707228b20cac5e0";   
$iv = "1234567890123456";                    
$AES = new AES_Encryption($key, $iv);

$Col1 = '123456789qwerty';
$Col2 = 'qwerty123456789';

$encrypted_1 = sqlite_escape_string($AES->encrypt($Col1));
$encrypted_2 = sqlite_escape_string($AES->encrypt($Col2));

INSERT INTO AES_T (encrypted_1 , encrypted_2 ) VALUES ('$encrypted_1', '$encrypted_2');

echo "ENC1:" . $encrypted_1;
echo "ENC2:" . $encrypted_2;
?>

好的,这个加密在MySQL中使用
MySQL\u real\u escape\u string()
。 使用
sqlite\u escape\u string()
它报告:致命错误:调用未定义的函数sqlite\u escape\u string()。AES PHP加密:对于加密,我使用以下方法:

我检查了phpinfo()并启用了:

  • PDO驱动程序:mysql
  • sqlite已启用
  • SQLite 3.x的PDO驱动程序已启用
  • 已启用SQLite库3.7.7.1
  • SQLite3支持SQLite3模块版本0.7已启用
  • 已启用SQLite库3.7.7.1

我使用的是WAMP服务器Apache版本2.22.22和PHP版本5.4.3,我在Zend服务器和常规Apache和PHP安装中尝试过,这是一个相同的错误。请在此方面寻求帮助。

sqlite\u escape\u字符串在PHP5.4中不推荐使用。转义数据库字符串的最佳方法是使用此处建议的PDO

虽然我同意这个答案,但deprecated与removed并不相同。它在理论上仍然可以工作,不是吗?好的,所以代替:$encrypted_1=sqlite_escape_string($AES->encrypt($Col1));我必须使用:$encrypted_1=SQLite3::escapeString($AES->encrypt($Col1));是的,我错了。。。它被移除了。从手册中可以看到,它仅在低于5.4的版本上可用。