本文整理匯總了PHP中Twitter::refresh方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::refresh方法的具體用法?PHP Twitter::refresh怎麽用?PHP Twitter::refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twitter
的用法示例。
在下文中一共展示了Twitter::refresh方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Twitter
<?php
/**
* Created by PhpStorm.
* User: kevin
* Date: 23/01/16
* Time: 21:34
*/
include_once 'db_wrap.php';
include "/home/aaron-aaron/www/src/class/Twitter.php";
$bd = new \db\db_handler();
$bd->init();
$sql = "DELETE FROM TWEET";
$bd->query($sql);
$sql = "SELECT * FROM TWITTER";
$stmt = $bd->query($sql);
while ($result = $stmt->fetch()) {
$newFlux = new Twitter($result['ID'], $result['NAME']);
$newFlux->refresh();
}
$bd->close();
示例2: searchTwitter
public function searchTwitter($name)
{
$sql = "SELECT COUNT(*) FROM TWITTER WHERE NAME = \"" . $name . "\"";
$result = $this->pdo->query($sql)->fetch();
if ($result[0] == 0) {
$sql = "INSERT INTO TWITTER(NAME) VALUES(\"" . $name . "\")";
$this->pdo->query($sql);
$idTwitter = $this->pdo->lastInsertId();
$sql = "INSERT INTO TWITTER_ASSOC(IDTWITTER,IDUSER) VALUES(" . $idTwitter . "," . $_SESSION['ID'] . ")";
$this->pdo->query($sql);
$twitter = new Twitter($idTwitter, $name);
$twitter->refresh();
} else {
$sql = "SELECT ID FROM TWITTER WHERE NAME = \"" . $name . "\"";
$result = $this->pdo->query($sql)->fetch();
$sql = "INSERT INTO TWITTER_ASSOC(IDTWITTER,IDUSER) VALUES(" . $result[0] . "," . $_SESSION['ID'] . ")";
$this->pdo->query($sql);
}
}