本文整理匯總了PHP中Token::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Token::getAll方法的具體用法?PHP Token::getAll怎麽用?PHP Token::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Token
的用法示例。
在下文中一共展示了Token::getAll方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: find
static function find($search_id)
{
$found_token = null;
$all_tokens = Token::getAll();
foreach ($all_tokens as $token) {
if ($token->getId() == $search_id) {
$found_token = $token;
}
}
return $found_token;
}
示例2: testDelete
function testDelete()
{
$patron_id = 1;
$menu_id = 2;
$sender_id = 3;
$test_token = new Token($patron_id, $menu_id, $sender_id);
$test_token->save();
$patron_id2 = 4;
$menu_id2 = 5;
$sender_id2 = 6;
$test_token2 = new Token($patron_id2, $menu_id2, $sender_id2);
$test_token2->save();
$test_token->delete();
$result = Token::getAll();
$this->assertEquals([$test_token2], $result);
}
示例3: spl_autoload_register
<?php
require 'config.php';
//Configuration
require 'HTTP/Request2.php';
/* Autoloading class.php **/
spl_autoload_register(function ($class) {
include 'lib/' . strtolower($class) . '.php';
});
$tokens = Token::getAll();
foreach ($tokens as $row) {
echo $row['service'] . '::' . $row['userid'] . "\n";
$className = ucfirst($row['service']);
$className::update($row['userid']);
if ($row['service'] == 'github') {
//perform a gitscore update as well
//since we don't store a token for it
Gitscore::update($row['userid']);
echo 'gitscore::' . $row['userid'] . "\n";
}
}