本文整理汇总了PHP中WhatsProt::setMessageStore方法的典型用法代码示例。如果您正苦于以下问题:PHP WhatsProt::setMessageStore方法的具体用法?PHP WhatsProt::setMessageStore怎么用?PHP WhatsProt::setMessageStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhatsProt
的用法示例。
在下文中一共展示了WhatsProt::setMessageStore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: data
$db->exec('CREATE TABLE data (`username` TEXT, `password` TEXT, `nickname` TEXT, `login` TEXT)');
$sql = 'INSERT INTO data (`username`, `password`, `nickname`, `login`) VALUES (:username, :password, :nickname, :login)';
$query = $db->prepare($sql);
$query->execute([':username' => $number, ':password' => $pw, ':nickname' => $nickname, ':login' => '1']);
}
$db = new \PDO('sqlite:' . $fileName, null, null, [PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$sql = 'SELECT username, password, nickname, login FROM data';
$row = $db->query($sql);
$result = $row->fetchAll();
$username = $result[0]['username'];
$password = $result[0]['password'];
$nickname = $result[0]['nickname'];
$login = $result[0]['login'];
$w = new WhatsProt($username, $nickname, $debug);
$GLOBALS['wa'] = $w;
$w->setMessageStore(new SqliteMessageStore($username));
$events = new MyEvents($w);
$w->eventManager()->bind('onGetSyncResult', 'onSyncResult');
$w->eventManager()->bind('onGetRequestLastSeen', 'onGetRequestLastSeen');
$w->eventManager()->bind('onPresenceAvailable', 'onPresenceAvailable');
$w->eventManager()->bind('onPresenceUnavailable', 'onPresenceUnavailable');
$w->eventManager()->bind('onGetImage', 'onGetImage');
$w->eventManager()->bind('onGetVideo', 'onGetVideo');
$w->eventManager()->bind('onGetAudio', 'onGetAudio');
$w->connect();
try {
$w->loginWithPassword($password);
} catch (Exception $e) {
echo "Error: {$e}";
exit;
}