本文整理汇总了PHP中Mail_mimeDecode::getMimeNumbers方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail_mimeDecode::getMimeNumbers方法的具体用法?PHP Mail_mimeDecode::getMimeNumbers怎么用?PHP Mail_mimeDecode::getMimeNumbers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail_mimeDecode
的用法示例。
在下文中一共展示了Mail_mimeDecode::getMimeNumbers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decode_structure
$filename = $message_data->date . '/' . $message_id . '/message';
break;
}
if (!@file_exists($quarantine_dir . '/' . $filename)) {
die("Error: file not found\n");
}
$file = file_get_contents($quarantine_dir . '/' . $filename);
}
}
$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;
$params['input'] = $file;
$Mail_mimeDecode = new Mail_mimeDecode($file);
$structure = $Mail_mimeDecode->decode($params);
$mime_struct = $Mail_mimeDecode->getMimeNumbers($structure);
// Make sure that part being requested actually exists
if (isset($_GET['part'])) {
if (!isset($mime_struct[$_GET['part']])) {
die("Part " . sanitizeInput($_GET['part']) . " not found\n");
}
}
function decode_structure($structure)
{
$type = $structure->ctype_primary . "/" . $structure->ctype_secondary;
switch ($type) {
case "text/plain":
/*
if (isset ($structure->ctype_parameters['charset']) &&
strtolower($structure->ctype_parameters['charset']) == 'utf-8'
) {
示例2: array
/**
* Given the output of the above function, this will return an
* array of references to the parts, indexed by mime number.
*
* @param object $structure The structure to go through
* @param string $mime_number Internal use only.
* @return array Mime numbers
*/
function &getMimeNumbers(&$structure, $no_refs = false, $mime_number = '', $prepend = '')
{
$return = array();
if (!empty($structure->parts)) {
if ($mime_number != '') {
$structure->mime_id = $prepend . $mime_number;
$return[$prepend . $mime_number] =& $structure;
}
for ($i = 0; $i < count($structure->parts); $i++) {
if (!empty($structure->headers['content-type']) and substr(strtolower($structure->headers['content-type']), 0, 8) == 'message/') {
$prepend = $prepend . $mime_number . '.';
$_mime_number = '';
} else {
$_mime_number = $mime_number == '' ? $i + 1 : sprintf('%s.%s', $mime_number, $i + 1);
}
$arr =& Mail_mimeDecode::getMimeNumbers($structure->parts[$i], $no_refs, $_mime_number, $prepend);
foreach ($arr as $key => $val) {
$no_refs ? $return[$key] = '' : ($return[$key] =& $arr[$key]);
}
}
} else {
if ($mime_number == '') {
$mime_number = '1';
}
$structure->mime_id = $prepend . $mime_number;
$no_refs ? $return[$prepend . $mime_number] = '' : ($return[$prepend . $mime_number] =& $structure);
}
return $return;
}