/** * 处理附件下载 * @param string $userId 微信用户ID * @param integer $appId 应用ID * @param string $aid 带附件类型的附件ID字符串 * @return mixed */ function doAttachDownload($userId, $appId, $aid) { $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $isIphone = strpos($agent, 'iphone') ? true : false; list($type, $id) = explode('/', $aid); if ($type == 'cloud') { list($id, $cloud) = explode('-', $id); } else { $cloud = 0; } $attachs = Attach::getAttachData($id); $attach = array_shift($attachs); if ($attach['uid'] != Ibos::app()->user->uid) { return close('您没有权限下载此文件'); } $filepath = File::getAttachUrl() . '/' . $attach['attachment']; if ($cloud) { $core = new FileCloud($cloud); $url = $core->getRealUrl($filepath); } else { $url = Ibos::app()->request->getHostInfo() . '/' . $filepath; } if ($isIphone) { header('Location:' . $url, true); exit; } else { Env::iExit("<h1>微信现只支持IOS系统在微信内打开下载,请长按链接选择打开或者复制下载链接到手机浏览器下载<br/>{$url}</h1>"); } }
<h1 class="art-title"><?php echo $subject; ?> </h1> <div class="art-ct mb"> <?php if ($type == 1) { ?> <div id="gallery" class="ad-gallery"> <div class="ad-image-wrapper"></div> <!-- <div class="ad-controls"></div> --> <div class="ad-nav"> <div class="ad-thumbs"> <ul class="ad-thumb-list"> <?php $attachDir = File::getAttachUrl() . '/'; ?> <?php foreach ($pictureData as $key => $picture) { ?> <li> <a href="<?php echo $attachDir . File::fileName($picture['attachment']); ?> "> <img src="<?php echo $attachDir . File::fileName($picture['attachment']); ?> " alt="<?php echo $picture['filename']; ?>