本文整理匯總了PHP中DAL::unsetVote_post方法的典型用法代碼示例。如果您正苦於以下問題:PHP DAL::unsetVote_post方法的具體用法?PHP DAL::unsetVote_post怎麽用?PHP DAL::unsetVote_post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DAL
的用法示例。
在下文中一共展示了DAL::unsetVote_post方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deletePost
public static function deletePost($post_id)
{
//delete img
//first get the post
$post = self::getPost($post_id);
//post->getImg
$img = $post->getImagesPost();
//foreach img delete img in the DB
if ($img != NULL) {
foreach ($img as $image) {
DAL::deleteImg($image->getImg_id());
}
//then in the files (somthing like rmdir /images/posts/$postid -R) !!!this section might rise errors...
$dir = 'images/posts/' . $post->getPost_id();
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
}
rmdir($dir);
}
//then get votes
$votes = $post->getVote_post();
//foreach vote, unset it
if ($votes != NULL) {
foreach ($votes as $vote) {
DAL::unsetVote_post($vote->getPost_id(), $vote->getUser()->getUsername());
}
}
DAL::deletePost($post_id);
}
示例2: unsetVote_post
static function unsetVote_post($post_id, $username)
{
DAL::unsetVote_post($post_id, $username);
}