當前位置: 首頁>>代碼示例>>PHP>>正文


PHP discuz_upload::get_target_extension方法代碼示例

本文整理匯總了PHP中discuz_upload::get_target_extension方法的典型用法代碼示例。如果您正苦於以下問題:PHP discuz_upload::get_target_extension方法的具體用法?PHP discuz_upload::get_target_extension怎麽用?PHP discuz_upload::get_target_extension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在discuz_upload的用法示例。


在下文中一共展示了discuz_upload::get_target_extension方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dfsockopen

     continue;
 }
 $content = '';
 if (preg_match('/^(http:\\/\\/|\\.)/i', $imageurl)) {
     $content = dfsockopen($imageurl);
 } elseif (preg_match('/^(' . preg_quote(getglobal('setting/attachurl'), '/') . ')/i', $imageurl)) {
     $imagereplace['newimageurl'][] = $value[0];
 }
 if (empty($content)) {
     continue;
 }
 $patharr = explode('/', $imageurl);
 $attach['name'] = trim($patharr[count($patharr) - 1]);
 $attach['thumb'] = '';
 $attach['isimage'] = $upload->is_image_ext($attach['ext']);
 $attach['extension'] = $upload->get_target_extension($attach['ext']);
 $attach['attachdir'] = $upload->get_target_dir('forum');
 $attach['attachment'] = $attach['attachdir'] . $upload->get_target_filename('forum') . '.' . $attach['extension'];
 $attach['target'] = getglobal('setting/attachdir') . './forum/' . $attach['attachment'];
 if (!@($fp = fopen($attach['target'], 'wb'))) {
     continue;
 } else {
     flock($fp, 2);
     fwrite($fp, $content);
     fclose($fp);
 }
 if (!$upload->get_image_info($attach['target'])) {
     @unlink($attach['target']);
     continue;
 }
 $attach['size'] = filesize($attach['target']);
開發者ID:vanloswang,項目名稱:DiscuzX,代碼行數:31,代碼來源:forum_ajax.php

示例2: forum_downremotefile


//.........這裏部分代碼省略.........
                        }
                        $content_md5_arr[] = md5($content);
                    } elseif (preg_match('/^(' . preg_quote(getglobal('setting/attachurl'), '/') . ')/i', $imageurl)) {
                        $imagereplace['newimageurl'][] = $value[0];
                    }
                    if (empty($content)) {
                        if ($value[4] == 1) {
                            if ($del_a == 1) {
                                $imagereplace['newimageurl'][] = $value[2];
                            } else {
                                unset($imagereplace['oldimageurl'][$key]);
                            }
                        } else {
                            $imagereplace['newimageurl'][] = '';
                        }
                        continue;
                    }
                    if (!$attach['name']) {
                        $patharr = explode('/', $imageurl);
                        $attach['name'] = trim($patharr[count($patharr) - 1]);
                    }
                    $patharr = explode('/', $imageurl);
                    if (!$attach['name']) {
                        $attach['name'] = trim($patharr[count($patharr) - 1]);
                    }
                    $attach['thumb'] = '';
                    $attach['ext'] = trim($attach['ext']);
                    //不加這個有些還真不行
                    $attach['isimage'] = $upload->is_image_ext($attach['ext']);
                    if ($attach['isimage'] == 1 && $arr['is_download_img'] != 1) {
                        $imagereplace['newimageurl'][] = $value[0];
                        continue;
                    }
                    $attach['extension'] = $upload->get_target_extension($attach['ext']);
                    $attach['attachdir'] = $upload->get_target_dir('forum');
                    $attach['attachment'] = $attach['attachdir'] . $upload->get_target_filename('forum') . '.' . $attach['extension'];
                    $attach['target'] = getglobal('setting/attachdir') . './forum/' . $attach['attachment'];
                    if (!in_array($attach['ext'], $get_file_ext_arr) && $get_file_ext_arr && $attach['isimage'] == 0) {
                        if ($value[4] == 1) {
                            if ($del_a == 1) {
                                $imagereplace['newimageurl'][] = $value[2];
                            } else {
                                unset($imagereplace['oldimageurl'][$key]);
                            }
                        } else {
                            $imagereplace['newimageurl'][] = '';
                        }
                        continue;
                    }
                    if (!@($fp = fopen($attach['target'], 'wb'))) {
                        continue;
                    } else {
                        flock($fp, 2);
                        fwrite($fp, $content);
                        fclose($fp);
                    }
                    if (!$upload->get_image_info($attach['target']) && $attach['isimage'] == 1) {
                        @unlink($attach['target']);
                        continue;
                    }
                    $attach['size'] = filesize($attach['target']);
                    $upload->attach = $attach;
                    $thumb = $width = 0;
                    if ($upload->attach['isimage']) {
                        if ($_G['setting']['thumbstatus']) {
                            $image = new image();
開發者ID:edmundwong,項目名稱:V604,代碼行數:67,代碼來源:function.article.php


注:本文中的discuz_upload::get_target_extension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。