PHP implementation of Statistical message size _php Tutorial

Source: Internet
Author: User
Count the amount of space the user Inbox, first calculate the size of each message (title + content + nearby), after the sum;
1, calculate the nearby size;
2. Calculate title and content size
3, sum to find a single message size
Case:
Copy CodeThe code is as follows:
$attach _size= 0;
if ($attachmentid) {//Get the size nearby
$attach _data= Attachdata ($attachmentid);
if ($attach _data) {
foreach ($attach _dataas$value) {
$attach _size+= $value [' filesize '];
}
}
}
Get the title and the size of the message content
$email _content_size= 0;
$_filename= "Attachment/emailsizecalculate.tmp";
$_file= fopen ($_filename, "WB");
Fwrite ($_file, $subject. $content);
Fclose ($_file);
if ($_temp= filesize ($_filename)) {
$email _content_size= $_temp;
}
$del _ret= @unlink ($_filename);
$sum _size= $attach _size*1024 + $email _content_size; Total message size
?>

http://www.bkjia.com/PHPjc/328075.html www.bkjia.com true http://www.bkjia.com/PHPjc/328075.html techarticle Count the amount of space the user Inbox, first calculate the size of each message (title + content + near), after the sum, 1, calculate the vicinity size, 2, calculate the title and content size 3, total ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.