当前位置: 首页>>代码示例>>PHP>>正文


PHP Upload::file方法代码示例

本文整理汇总了PHP中Upload::file方法的典型用法代码示例。如果您正苦于以下问题:PHP Upload::file方法的具体用法?PHP Upload::file怎么用?PHP Upload::file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Upload的用法示例。


在下文中一共展示了Upload::file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upload

 public function upload($username)
 {
     if (!get('_csrf') or !csrf(get('_csrf'))) {
         return response::error('unauthenticated access');
     }
     $user = $this->user($username);
     if (!$user) {
         return response::error(l('users.avatar.error.missing'));
     }
     if (!site()->user()->isAdmin() and !$user->isCurrent()) {
         return response::error('You are not allowed to upload an avatar for this user');
     }
     $root = $user->avatar() ? $user->avatar()->root() : $user->avatarRoot('{safeExtension}');
     $upload = new Upload($root, array('accept' => function ($upload) {
         if ($upload->type() != 'image') {
             throw new Error(l('users.avatar.error.type'));
         }
     }));
     if ($upload->file()) {
         thumb::$defaults['root'] = dirname($upload->file()->root());
         $thumb = new Thumb($upload->file(), array('filename' => $upload->file()->filename(), 'overwrite' => true, 'width' => 256, 'height' => 256, 'crop' => true));
         kirby()->trigger('panel.avatar.upload', $user->avatar());
         return response::success(l('users.avatar.success'));
     } else {
         return response::error($upload->error()->getMessage());
     }
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:27,代码来源:avatars.php

示例2: upload

 public function upload(array $file, array $types = array(), $max_size = NULL)
 {
     $filename = Upload::file($file, NULL, NULL, $types, $max_size);
     $tmp_file = TMPPATH . trim($filename);
     if (!file_exists($tmp_file) or is_dir($tmp_file)) {
         throw new Kohana_Exception('Tempory file not exists :file', array(':file' => $tmp_file));
     }
     $path = 'media' . DIRECTORY_SEPARATOR . substr($filename, 0, 3) . DIRECTORY_SEPARATOR;
     $abs_path = PUBLICPATH . $path;
     if (!is_dir($abs_path)) {
         mkdir($abs_path, 0777, TRUE);
         chmod($abs_path, 0777);
     }
     $file = $abs_path . $filename;
     if (!copy($tmp_file, $file)) {
         throw new Kohana_Exception("Can't copy file :file", array(':file' => $tmp_file));
     }
     chmod($file, 0777);
     unlink($tmp_file);
     try {
         $content_type = 'image';
         $params = getimagesize($file);
     } catch (Exception $ex) {
         $content_type = 'file';
         $params = array();
     }
     return $this->set('size', filesize($abs_path))->set('content_type', $content_type)->set('filename', str_replace(array('/', '\\'), '/', $path) . $filename)->set('params', $params)->save();
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:28,代码来源:media.php

示例3: replace

 public function replace($id = null)
 {
     if (!get('_csrf') or !csrf(get('_csrf'))) {
         return response::error('unauthenticated access');
     }
     $filename = get('filename');
     $file = $this->file($id, $filename);
     $blueprint = blueprint::find($this->page($id));
     $upload = new Upload($file->root(), array('overwrite' => true, 'accept' => function ($upload) use($file) {
         if ($upload->mime() != $file->mime()) {
             throw new Error(l('files.replace.error.type'));
         }
     }));
     if ($file = $upload->file()) {
         try {
             $this->checkUpload($file, $blueprint);
             kirby()->trigger('panel.file.replace', $file);
             return response::success('success');
         } catch (Exception $e) {
             $file->delete();
             return response::error($e->getMessage());
         }
     } else {
         return response::error($upload->error()->getMessage());
     }
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:26,代码来源:files.php

示例4: upload

 public function upload($username)
 {
     $user = $this->user($username);
     if (!$user) {
         return response::error(l('users.avatar.error.missing'));
     }
     $root = $user->avatar() ? $user->avatar()->root() : $user->avatarRoot('{safeExtension}');
     $upload = new Upload($root, array('accept' => function ($upload) {
         if ($upload->type() != 'image') {
             throw new Error(l('users.avatar.error.type'));
         }
     }));
     if ($upload->file()) {
         thumb::$defaults['root'] = dirname($upload->file()->root());
         thumb::$defaults['driver'] = 'im';
         $thumb = new Thumb($upload->file(), array('filename' => $upload->file()->filename(), 'overwrite' => true, 'width' => 256, 'height' => 256, 'crop' => true));
         return response::success(l('users.avatar.success'));
     } else {
         return response::error($upload->error()->getMessage());
     }
 }
开发者ID:kompuser,项目名称:panel,代码行数:21,代码来源:avatars.php

示例5: replace

 public function replace($id)
 {
     $filename = get('filename');
     $file = $this->file($id, $filename);
     $upload = new Upload($file->root(), array('overwrite' => true, 'accept' => function ($upload) use($file) {
         if ($upload->mime() != $file->mime()) {
             throw new Error(l('files.replace.error.type'));
         }
     }));
     if ($upload->file()) {
         return response::success('success');
     } else {
         return response::error($upload->error()->getMessage());
     }
 }
开发者ID:kompuser,项目名称:panel,代码行数:15,代码来源:files.php

示例6: redirect

        redirect(HOST . DIR . '/admin/admin_ranks.php');
    } else {
        redirect(HOST . DIR . '/admin/admin_ranks_add.php?error=incomplete#errorh');
    }
} elseif (!empty($_FILES['upload_ranks']['name'])) {
    @clearstatcache();
    $dir = PATH_TO_ROOT . '/templates/' . get_utheme() . '/images/ranks/';
    if (!is_writable($dir)) {
        $is_writable = @chmod($dir, 0777) ? true : false;
    }
    @clearstatcache();
    $error = '';
    if (is_writable($dir)) {
        import('io/upload');
        $Upload = new Upload($dir);
        if (!$Upload->file('upload_ranks', '`([a-z0-9_ -])+\\.(jpg|gif|png|bmp)+$`i')) {
            $error = $Upload->error;
        }
    } else {
        $error = 'e_upload_failed_unwritable';
    }
    $error = !empty($error) ? '?error=' . $error : '';
    redirect(HOST . SCRIPT . $error);
} else {
    $Template->set_filenames(array('admin_ranks_add' => 'admin/admin_ranks_add.tpl'));
    $get_error = retrieve(GET, 'error', '');
    $array_error = array('e_upload_invalid_format', 'e_upload_max_weight', 'e_upload_error', 'e_upload_failed_unwritable');
    if (in_array($get_error, $array_error)) {
        $Errorh->handler($LANG[$get_error], E_USER_WARNING);
    }
    if ($get_error == 'incomplete') {
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:admin_ranks_add.php

示例7: strtodate

 $user_born = strtodate(retrieve(POST, 'user_born', '0'), $LANG['date_birth_parse']);
 import('util/captcha');
 $Captcha = new Captcha();
 $Captcha->set_difficulty($CONFIG_USER['verif_code_difficulty']);
 if (!($CONFIG_USER['verif_code'] == '1') || $Captcha->is_valid()) {
     if (strlen($login) >= 3 && strlen($password) >= 6 && strlen($password_bis) >= 6) {
         if (!empty($login) && !empty($user_mail) && $password_hash === $password_bis_hash) {
             ####Vérification de la validité de l'avatar####
             $user_avatar = '';
             //Gestion upload d'avatar.
             $dir = '../images/avatars/';
             import('io/upload');
             $Upload = new Upload($dir);
             if (is_writable($dir) && $CONFIG_USER['activ_up_avatar'] == 1) {
                 if ($_FILES['avatars']['size'] > 0) {
                     $Upload->file('avatars', '`([a-z0-9()_-])+\\.(jpg|gif|png|bmp)+$`i', UNIQ_NAME, $CONFIG_USER['weight_max'] * 1024);
                     if (!empty($Upload->error)) {
                         redirect(HOST . DIR . '/member/register' . url('.php?erroru=' . $Upload->error) . '#errorh');
                     } else {
                         $path = $dir . $Upload->filename['avatars'];
                         $error = $Upload->validate_img($path, $CONFIG_USER['width_max'], $CONFIG_USER['height_max'], DELETE_ON_ERROR);
                         if (!empty($error)) {
                             redirect(HOST . DIR . '/member/register' . url('.php?erroru=' . $error) . '#errorh');
                         } else {
                             $user_avatar = $path;
                         }
                     }
                 }
             }
             $path = retrieve(POST, 'avatar', '');
             if (!empty($path)) {
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:register_valid.php

示例8: array

<?php

include "models/function.php";
$id = $_GET['id'];
$param = "dop";
$records = DB::select($param);
if (isset($_POST["go"])) {
    $arrayDop = array("name" => $_POST['name'], "id_kurs" => $_POST['kurs']);
    $dopSrcTmp = Upload::file($_FILES['file'], "materials");
    if ($dopSrcTmp || $_POST['url']) {
        if ($dopSrcTmp) {
            $arrayDop += array("src" => $dopSrcTmp);
        } else {
            $arrayDop += array("src" => "");
        }
        if ($_POST['url']) {
            $arrayDop += array("url" => $_POST['url']);
        } else {
            $arrayDop += array("url" => "");
        }
    }
    if ($_POST["go"] == "save") {
        DB::insert(DB::insertSql($param, $arrayDop), $arrayDop);
    } else {
        $idKurs = $_POST["go"];
        DB::update(DB::updateSql($param, $arrayDop), $arrayDop, $idKurs);
    }
    header("Location: materials.php");
}
if (isset($_GET["delete"])) {
    Delete::del($_GET["title"], $_GET["delete"]);
开发者ID:Torredo,项目名称:lessons,代码行数:31,代码来源:materials.php

示例9: Gallery

require_once '../admin/admin_header.php';
$Cache->load('gallery');
include_once '../gallery/gallery.class.php';
$Gallery = new Gallery();
$idcat = !empty($_GET['cat']) ? numeric($_GET['cat']) : 0;
$idcat_post = !empty($_POST['idcat_post']) ? numeric($_POST['idcat_post']) : 0;
$add_pic = !empty($_GET['add']) ? numeric($_GET['add']) : 0;
$nbr_pics_post = !empty($_POST['nbr_pics']) ? numeric($_POST['nbr_pics']) : 0;
if (isset($_FILES['gallery']) && isset($_POST['idcat_post'])) {
    $dir = 'pics/';
    import('io/upload');
    $Upload = new Upload($dir);
    $idpic = 0;
    if (is_writable($dir)) {
        if ($_FILES['gallery']['size'] > 0) {
            $Upload->file('gallery', '`([a-z0-9()_-])+\\.(jpg|gif|png)+$`i', UNIQ_NAME, $CONFIG_GALLERY['weight_max']);
            if (!empty($Upload->error)) {
                redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $Upload->error . '#errorh');
            } else {
                $path = $dir . $Upload->filename['gallery'];
                $error = $Upload->validate_img($path, $CONFIG_GALLERY['width_max'], $CONFIG_GALLERY['height_max'], DELETE_ON_ERROR);
                if (!empty($error)) {
                    redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $error . '#errorh');
                } else {
                    $Gallery->Resize_pics($path);
                    if (!empty($Gallery->error)) {
                        redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $Gallery->error . '#errorh');
                    }
                    $name = !empty($_POST['name']) ? strprotect($_POST['name']) : '';
                    $idpic = $Gallery->Add_pics($idcat_post, $name, $Upload->filename['gallery'], $User->get_attribute('user_id'));
                    if (!empty($Gallery->error)) {
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:admin_gallery_add.php

示例10: elseif

    }
} elseif ($home_folder) {
    //Retour à la racine.
    AppContext::get_response()->redirect('/admin/admin_files.php');
} elseif (!empty($_FILES['upload_file']['name']) && $folder) {
    //Si le dossier n'est pas en écriture on tente un CHMOD 777
    @clearstatcache();
    $dir = PATH_TO_ROOT . '/upload/';
    if (!is_writable($dir)) {
        $is_writable = @chmod($dir, 0777);
    }
    @clearstatcache();
    $error = '';
    if (is_writable($dir)) {
        $Upload = new Upload($dir);
        $Upload->file('upload_file', '`([a-z0-9()_-])+\\.(' . implode('|', array_map('preg_quote', FileUploadConfig::load()->get_authorized_extensions())) . ')+$`i', Upload::UNIQ_NAME);
        if ($Upload->get_error() != '') {
            //Erreur, on arrête ici
            AppContext::get_response()->redirect('/admin/admin_files.php?f=' . $folder . '&erroru=' . $Upload->get_error() . '#message_helper');
        } else {
            $check_user_folder = 0;
            try {
                $check_user_folder = PersistenceContext::get_querier()->get_column_value(DB_TABLE_UPLOAD_CAT, 'user_id', 'WHERE id=:id', array('id' => $folder));
            } catch (RowNotFoundException $e) {
            }
            $user_id = $check_user_folder <= 0 ? -1 : AppContext::get_current_user()->get_id();
            $user_id = max($user_id, $folder_member);
            $result = PersistenceContext::get_querier()->insert(DB_TABLE_UPLOAD, array('idcat' => $folder, 'name' => $Upload->get_original_filename(), 'path' => $Upload->get_filename(), 'user_id' => $user_id, 'size' => $Upload->get_human_readable_size(), 'type' => $Upload->get_extension(), 'timestamp' => time()));
            $id_file = $result->get_last_inserted_id();
        }
    } else {
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:admin_files.php

示例11: redirect

        redirect(HOST . DIR . '/admin/admin_themes_add.php?error=e_theme_already_exist#errorh');
    }
} elseif (!empty($_FILES['upload_theme']['name'])) {
    @clearstatcache();
    $dir = '../templates/';
    if (!is_writable($dir)) {
        $is_writable = @chmod($dir, 0777) ? true : false;
    }
    @clearstatcache();
    $error = '';
    if (is_writable($dir)) {
        $check_theme = $Sql->query("SELECT COUNT(*) FROM " . DB_TABLE_THEMES . " WHERE theme = '" . strprotect($_FILES['upload_theme']['name']) . "'", __LINE__, __FILE__);
        if (empty($check_theme) && !is_dir('../templates/' . $_FILES['upload_theme']['name'])) {
            import('io/upload');
            $Upload = new Upload($dir);
            if ($Upload->file('upload_theme', '`([a-z0-9()_-])+\\.(gzip|zip)+$`i')) {
                $archive_path = '../templates/' . $Upload->filename['upload_theme'];
                if ($Upload->extension['upload_theme'] == 'gzip') {
                    import('lib/pcl/pcltar', LIB_IMPORT);
                    if (!($zip_files = PclTarExtract($Upload->filename['upload_theme'], '../templates/'))) {
                        $error = $Upload->error;
                    }
                } elseif ($Upload->extension['upload_theme'] == 'zip') {
                    import('lib/pcl/pclzip', LIB_IMPORT);
                    $Zip = new PclZip($archive_path);
                    if (!($zip_files = $Zip->extract(PCLZIP_OPT_PATH, '../templates/', PCLZIP_OPT_SET_CHMOD, 0666))) {
                        $error = $Upload->error;
                    }
                } else {
                    $error = 'e_upload_invalid_format';
                }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:admin_themes_add.php

示例12: url

     $error_controller = PHPBoostErrors::user_not_authorized();
     DispatchManager::redirect($error_controller);
 }
 //Niveau d'autorisation de la catégorie, accès en écriture.
 if (!$Gallery->auth_upload_pics(AppContext::get_current_user()->get_id(), AppContext::get_current_user()->get_level())) {
     AppContext::get_response()->redirect('/gallery/gallery' . url('.php?add=1&cat=' . $id_category . '&error=upload_limit', '-' . $id_category . '.php?add=1&error=upload_limit', '&') . '#message_helper');
 }
 $dir = 'pics/';
 $authorized_pictures_extensions = FileUploadConfig::load()->get_authorized_picture_extensions();
 $error = '';
 if (!empty($authorized_pictures_extensions)) {
     $Upload = new Upload($dir);
     $idpic = 0;
     $idcat_post = retrieve(POST, 'cat', '');
     $name_post = retrieve(POST, 'name', '', TSTRING_AS_RECEIVED);
     if (!$Upload->file('gallery', '`([a-z0-9()_-])+\\.(' . implode('|', array_map('preg_quote', $authorized_pictures_extensions)) . ')+$`i', Upload::UNIQ_NAME, $config->get_max_weight())) {
         $error = $Upload->get_error();
     }
 } else {
     $error = 'e_upload_invalid_format';
 }
 if ($error != '') {
     AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $error) . '#message_helper');
 } else {
     $path = $dir . $Upload->get_filename();
     $error = $Upload->check_img($config->get_max_width(), $config->get_max_height(), Upload::DELETE_ON_ERROR);
     if (!empty($error)) {
         //Erreur, on arrête ici
         AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $error) . '#message_helper');
     } else {
         //Enregistrement de l'image dans la bdd.
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:gallery.php

示例13: Upload

 $unlimited_data = $group_limit === -1 || AppContext::get_current_user()->check_level(User::ADMIN_LEVEL);
 $member_memory_used = Uploads::Member_memory_used(AppContext::get_current_user()->get_id());
 if ($member_memory_used >= $group_limit && !$unlimited_data) {
     $error = 'e_max_data_reach';
 } else {
     //Si le dossier n'est pas en écriture on tente un CHMOD 777
     @clearstatcache();
     $dir = PATH_TO_ROOT . '/upload/';
     if (!is_writable($dir)) {
         $is_writable = @chmod($dir, 0777);
     }
     @clearstatcache();
     if (is_writable($dir)) {
         $weight_max = $unlimited_data ? 100000000 : $group_limit - $member_memory_used;
         $Upload = new Upload($dir);
         $Upload->file('upload_file', '`([a-z0-9()_-])+\\.(' . implode('|', array_map('preg_quote', $files_upload_config->get_authorized_extensions())) . ')+$`i', Upload::UNIQ_NAME, $weight_max);
         if ($Upload->get_error() != '') {
             $error = $Upload->get_error();
             if ($Upload->get_error() == 'e_upload_max_weight') {
                 $error = 'e_max_data_reach';
             }
             AppContext::get_response()->redirect('/user/upload.php?f=' . $folder . '&erroru=' . $error . '&' . $popup_noamp . '#message_helper');
         } else {
             $result = PersistenceContext::get_querier()->insert(DB_TABLE_UPLOAD, array('idcat' => $folder, 'name' => $Upload->get_original_filename(), 'path' => $Upload->get_filename(), 'user_id' => AppContext::get_current_user()->get_id(), 'size' => $Upload->get_human_readable_size(), 'type' => $Upload->get_extension(), 'timestamp' => time()));
             $id_file = $result->get_last_inserted_id();
         }
     } else {
         $error = 'e_upload_failed_unwritable';
     }
 }
 $anchor = !empty($error) ? '&error=' . $error . '&' . $popup_noamp . '#message_helper' : '&' . $popup_noamp . (!empty($id_file) ? '#fi1' . $id_file : '');
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:upload.php

示例14: array

<?php

include "models/function.php";
$param = "kurs";
if (isset($_POST["go"])) {
    $arrayKurs = array("name" => $_POST['name'], "text" => $_POST['text']);
    $kursSrcTmp = Upload::file($_FILES['preview'], "kurs");
    if ($kursSrcTmp) {
        $arrayKurs += array("src" => $kursSrcTmp);
    } else {
        if ($_POST["go"] == "save") {
            $arrayKurs += array("src" => "");
        }
    }
    if ($_POST["go"] == "save") {
        $idKurs = DB::insert(DB::insertSql($param, $arrayKurs), $arrayKurs);
    } else {
        $idKurs = $_POST["go"];
        DB::update(DB::updateSql($param, $arrayKurs), $arrayKurs, $idKurs);
    }
    header("Location: " . $param . ".php");
}
$records = DB::select($param);
require_once 'view/tpl_top.php';
?>
    <div class="app app-header-fixed  ">
        <?php 
include "view/header.php";
include "view/tpl_popup_kurs.php";
$active_e = "class=\"active\"";
include "view/nav.php";
开发者ID:Torredo,项目名称:lessons,代码行数:31,代码来源:kurs.php

示例15: upload_module

 private function upload_module()
 {
     $modules_folder = PATH_TO_ROOT . '/';
     if (!is_writable($modules_folder)) {
         $is_writable = @chmod($dir, 0755);
     } else {
         $is_writable = true;
     }
     if ($is_writable) {
         $uploaded_file = $this->form->get_value('file');
         if ($uploaded_file !== null) {
             $upload = new Upload($modules_folder);
             if ($upload->file('upload_module_file', '`([a-z0-9()_-])+\\.(gz|zip)+$`i')) {
                 $archive = $modules_folder . $upload->get_filename();
                 if ($upload->get_extension() == 'gz') {
                     include_once PATH_TO_ROOT . '/kernel/lib/php/pcl/pcltar.lib.php';
                     $archive_content = PclTarList($upload->get_filename());
                 } else {
                     include_once PATH_TO_ROOT . '/kernel/lib/php/pcl/pclzip.lib.php';
                     $zip = new PclZip($archive);
                     $archive_content = $zip->listContent();
                 }
                 $archive_root_content = array();
                 $required_files = array('/config.ini', '/index.php');
                 foreach ($archive_content as $element) {
                     if (substr($element['filename'], -1) == '/') {
                         $element['filename'] = substr($element['filename'], 0, -1);
                     }
                     if (substr_count($element['filename'], '/') == 0) {
                         $archive_root_content[] = array('filename' => $element['filename'], 'folder' => isset($element['folder']) && $element['folder'] == 1 || isset($element['typeflag']) && $element['typeflag'] == 5);
                     }
                     if (isset($archive_root_content[0])) {
                         $name_in_archive = str_replace($archive_root_content[0]['filename'] . '/', '/', $element['filename']);
                         if (in_array($name_in_archive, $required_files)) {
                             unset($required_files[array_search($name_in_archive, $required_files)]);
                         }
                     }
                 }
                 if (count($archive_root_content) == 1 && $archive_root_content[0]['folder'] && empty($required_files)) {
                     $module_id = $archive_root_content[0]['filename'];
                     if (!ModulesManager::is_module_installed($module_id)) {
                         if ($upload->get_extension() == 'gz') {
                             PclTarExtract($upload->get_filename(), $modules_folder);
                         } else {
                             $zip->extract(PCLZIP_OPT_PATH, $modules_folder, PCLZIP_OPT_SET_CHMOD, 0755);
                         }
                         $this->install_module($module_id, true);
                     } else {
                         $this->view->put('MSG', MessageHelper::display(LangLoader::get_message('element.already_exists', 'status-messages-common'), MessageHelper::NOTICE));
                     }
                 } else {
                     $this->view->put('MSG', MessageHelper::display(LangLoader::get_message('error.invalid_archive_content', 'status-messages-common'), MessageHelper::NOTICE));
                 }
                 $uploaded_file = new File($archive);
                 $uploaded_file->delete();
             } else {
                 $this->view->put('MSG', MessageHelper::display($this->lang['modules.upload_invalid_format'], MessageHelper::NOTICE));
             }
         } else {
             $this->view->put('MSG', MessageHelper::display($this->lang['modules.upload_error'], MessageHelper::NOTICE));
         }
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:63,代码来源:AdminModuleAddController.class.php


注:本文中的Upload::file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。