$screen_name = 'demo'; $oauth_token = 'xxxxxxxx'; $oauth_secret = 'xxxxxxxxxx';
$cb = \Codebird\Codebird::getInstance();
$cb->setToken($oauth_token, $oauth_secret);
如何使用“Codebird”类删除我的推文?
我们可以使用 Codebird 库删除 Twitter 推文:
$reply = $cb->statuses_destroy_ID([
'id' => 'TWEET_ID'
]);
Twitter 的 API 方法有一种映射到 Codebird 函数调用的通用方法。一般规则是:
对于 Twitter API 方法中的每个斜杠,请在 Codebird 函数中使用下划线。
示例:
statuses/update
映射到 Codebird::statuses_update()
。对于 Twitter API 方法中的每个下划线,请在 Codebird 函数中使用驼峰命名法。
示例:
statuses/home_timeline
映射到 Codebird::statuses_homeTimeline()
。对于方法中的每个参数模板,在 Codebird 函数中使用大写。 另外,不要忘记将该参数包含在参数列表中。
示例:
statuses/delete/:id
映射到 Codebird::statuses_delete_ID('id=12345')
。users/profile_image/:screen_name
映射到
Codebird::users_profileImage_SCREEN_NAME('screen_name=jublonet')
。