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


PHP Drupal::configFactory方法代码示例

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


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

示例1: testSoftBlocking

 /**
  * Test soft blocking.
  */
 public function testSoftBlocking()
 {
     // Allow 3 attempts to login before being soft-blocking is enforced.
     $config = \Drupal::configFactory()->getEditable('login_security.settings');
     $config->set('user_wrong_count', 0)->save();
     $config->set('host_wrong_count', 2)->save();
     // Remove notices.
     $config->set('notice_attempts_available', 0)->save();
     $normal_user = $this->drupalCreateUser();
     $good_pass = $normal_user->getPassword();
     // Intentionally break the password to repeat invalid logins.
     $new_pass = user_password();
     $normal_user->setPassword($new_pass);
     $site_name = \Drupal::config('system.site')->get('name');
     // First try.
     $this->assertNoSoftBlocked($normal_user);
     // Second try.
     $this->assertNoSoftBlocked($normal_user);
     // Remove error messages display.
     $config->set('disable_core_login_error', 1)->save();
     // Third try, still valid without soft blocking.
     $this->assertNoSoftBlocked($normal_user);
     // Restore error messages.
     $config->set('disable_core_login_error', 0)->save();
     // 4th attempt, the host is not allowed this time.
     $this->assertSoftBlocked($normal_user);
     // Try a normal login because it should be locked out now.
     $normal_user->setPassword($good_pass);
     $this->assertSoftBlocked($normal_user);
 }
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:33,代码来源:LoginSecuritySoftBlockTest.php

示例2: testUserRegisterForm

 /**
  * Test user registration integration.
  */
 public function testUserRegisterForm()
 {
     $id = $this->type->id();
     $field_name = $this->field->getName();
     $this->field->setRequired(TRUE);
     $this->field->save();
     // Allow registration without administrative approval and log in user
     // directly after registering.
     \Drupal::configFactory()->getEditable('user.settings')->set('register', USER_REGISTER_VISITORS)->set('verify_mail', 0)->save();
     user_role_grant_permissions(AccountInterface::AUTHENTICATED_ROLE, ['view own test profile']);
     // Verify that the additional profile field is attached and required.
     $name = $this->randomMachineName();
     $pass_raw = $this->randomMachineName();
     $edit = ['name' => $name, 'mail' => $this->randomMachineName() . '@example.com', 'pass[pass1]' => $pass_raw, 'pass[pass2]' => $pass_raw];
     $this->drupalPostForm('user/register', $edit, t('Create new account'));
     $this->assertRaw(new FormattableMarkup('@name field is required.', ['@name' => $this->field->getLabel()]));
     // Verify that we can register.
     $edit["entity_" . $id . "[{$field_name}][0][value]"] = $this->randomMachineName();
     $this->drupalPostForm(NULL, $edit, t('Create new account'));
     $this->assertText(new FormattableMarkup('Registration successful. You are now logged in.', []));
     $new_user = user_load_by_name($name);
     $this->assertTrue($new_user->isActive(), 'New account is active after registration.');
     // Verify that a new profile was created for the new user ID.
     $profile = \Drupal::entityTypeManager()->getStorage('profile')->loadByUser($new_user, $this->type->id());
     $this->assertEqual($profile->get($field_name)->value, $edit["entity_" . $id . "[{$field_name}][0][value]"], 'Field value found in loaded profile.');
     // Verify that the profile field value appears on the user account page.
     $this->drupalGet('user');
     $this->assertText($edit["entity_" . $id . "[{$field_name}][0][value]"], 'Field value found on user account page.');
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:32,代码来源:ProfileAttachTest.php

示例3: update

 /**
  * Get subscription status from the Acquia Network, and store the result.
  *
  * This check also sends a heartbeat to the Acquia Network unless
  * $params['no_heartbeat'] == 1.
  *
  * @param array $params
  *
  * @return FALSE, integer (error number), or subscription data.
  */
 static function update($params = array())
 {
     $config = \Drupal::configFactory()->getEditable('acquia_connector.settings');
     $current_subscription = $config->get('subscription_data');
     $subscription = FALSE;
     if (!self::hasCredentials()) {
         // If there is not an identifier or key, delete any old subscription data.
         $config->clear('subscription_data')->set('subscription_data', ['active' => FALSE])->save();
     } else {
         // Get our subscription data
         try {
             $subscription = \Drupal::service('acquia_connector.client')->getSubscription($config->get('identifier'), $config->get('key'), $params);
         } catch (ConnectorException $e) {
             switch ($e->getCustomMessage('code')) {
                 case static::NOT_FOUND:
                 case static::EXPIRED:
                     // Fall through since these values are stored and used by
                     // acquia_search_acquia_subscription_status()
                     $subscription = $e->getCustomMessage('code');
                     break;
                 default:
                     // Likely server error (503) or connection timeout (-110) so leave
                     // current subscription in place. _acquia_agent_request() logged an
                     // error message.
                     return $current_subscription;
             }
         }
         if ($subscription) {
             \Drupal::moduleHandler()->invokeAll('acquia_subscription_status', [$subscription]);
             $config->set('subscription_data', $subscription)->save();
         }
     }
     return $subscription;
 }
开发者ID:alexku,项目名称:travisintegrationtest,代码行数:44,代码来源:Subscription.php

示例4: testConfigTranslationsExist

 /**
  * Confirm the config defaults show on the translations page.
  */
 public function testConfigTranslationsExist()
 {
     // Ensure the config shows on the admin form.
     $this->drupalGet('admin/config/regional/config-translation');
     $this->assertResponse(200);
     $this->assertText(t('Metatag defaults'));
     // Load the main metatag_defaults config translation page.
     $this->drupalGet('admin/config/regional/config-translation/metatag_defaults');
     $this->assertResponse(200);
     // @todo Update this to confirm the H1 is loaded.
     $this->assertRaw(t('Metatag defaults'));
     // Load all of the Metatag defaults.
     $defaults = \Drupal::configFactory()->listAll('metatag.metatag_defaults');
     /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
     $config_manager = \Drupal::service('config.manager');
     // Confirm each of the configs is available on the translation form.
     foreach ($defaults as $config_name) {
         if ($config_entity = $config_manager->loadConfigEntityByName($config_name)) {
             $this->assertText($config_entity->label());
         }
     }
     // Confirm that each config translation page can be loaded.
     foreach ($defaults as $config_name) {
         if ($config_entity = $config_manager->loadConfigEntityByName($config_name)) {
             $this->drupalGet('admin/config/search/metatag/' . $config_entity->id() . '/translate');
             $this->assertResponse(200);
         } else {
             $this->error('Unable to load a Metatag default config: ' . $config_name);
         }
     }
 }
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:34,代码来源:MetatagConfigTranslationTest.php

示例5: testUserHooks

 public function testUserHooks()
 {
     FieldStorageConfig::create(array('field_name' => 'field_text', 'type' => 'string', 'entity_type' => 'user'))->save();
     FieldConfig::create(array('field_name' => 'field_text', 'type' => 'string', 'entity_type' => 'user', 'bundle' => 'user'))->save();
     $this->assertIdentical('', \Drupal::config('name.settings')->get('user_preferred'));
     FieldStorageConfig::create(array('field_name' => 'field_name_test', 'type' => 'name', 'entity_type' => 'user'))->save();
     FieldStorageConfig::create(array('field_name' => 'field_name_test2', 'type' => 'name', 'entity_type' => 'user'))->save();
     $field = FieldConfig::create(array('field_name' => 'field_name_test', 'type' => 'name', 'entity_type' => 'user', 'bundle' => 'user'));
     $field->save();
     $field2 = FieldConfig::create(array('field_name' => 'field_name_test2', 'type' => 'name', 'entity_type' => 'user', 'bundle' => 'user'));
     $field2->save();
     $this->assertEqual($field->getName(), \Drupal::config('name.settings')->get('user_preferred'));
     \Drupal::configFactory()->getEditable('name.settings')->set('user_preferred', $field2->getName())->save();
     $field2->delete();
     $this->assertEqual('', \Drupal::config('name.settings')->get('user_preferred'));
     \Drupal::configFactory()->getEditable('name.settings')->set('user_preferred', $field->getName())->save();
     $account = User::create(array('name' => 'test'));
     $account->field_name_test[0] = array('given' => 'Max', 'family' => 'Mustermann');
     $account->save();
     $account = User::load($account->id());
     $this->assertEqual('Max Mustermann', $account->realname);
     $this->assertEqual('Max Mustermann', user_format_name($account));
     $this->assertEqual('test', $account->getUsername());
     $this->assertEqual('Max Mustermann', $account->getDisplayName());
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:25,代码来源:NameUserTest.php

示例6: testAjaxWithAdminRoute

  public function testAjaxWithAdminRoute() {
    \Drupal::service('theme_installer')->install(['stable', 'seven']);
    $theme_config = \Drupal::configFactory()->getEditable('system.theme');
    $theme_config->set('admin', 'seven');
    $theme_config->set('default', 'stable');
    $theme_config->save();

    $account = $this->drupalCreateUser(['view the administration theme']);
    $this->drupalLogin($account);

    // First visit the site directly via the URL. This should render it in the
    // admin theme.
    $this->drupalGet('admin/ajax-test/theme');
    $assert = $this->assertSession();
    $assert->pageTextContains('Current theme: seven');

    // Now click the modal, which should also use the admin theme.
    $this->drupalGet('ajax-test/dialog');
    $assert->pageTextNotContains('Current theme: stable');
    $this->clickLink('Link 8 (ajax)');
    $assert->assertWaitOnAjaxRequest();

    $assert->pageTextContains('Current theme: stable');
    $assert->pageTextNotContains('Current theme: seven');
  }
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:25,代码来源:AjaxTest.php

示例7: buildForm

 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $system_roles = user_roles($membersonly = TRUE);
     $config = \Drupal::config('registration_role_with_approval.settings');
     $site_config = \Drupal::configFactory()->get('system.mail');
     $mailing_list = $config->get('mailing_list');
     if ($mailing_list == "") {
         $mailing_list .= $site_config->get('mail');
     }
     $email_subject = $config->get('email_subject');
     $email_body = $config->get('email_body');
     $profile_roles = $config->get('profile_roles');
     $form['roles'] = array('#type' => 'fieldset', '#title' => t('Avaliable Roles on registration form'), '#collapsible' => TRUE);
     foreach ($system_roles as $system_role) {
         $role_id = $system_role->id();
         if ($role_id != '0' && $role_id != 'authenticated') {
             $form['roles'][$system_role->id()] = array('#type' => 'checkbox', '#title' => t($system_role->label()), '#default_value' => $profile_roles[$system_role->id()]['default']);
             $form['roles'][$system_role->id() . "needs_approval"] = array('#type' => 'checkbox', '#title' => t('needs approval'), '#states' => array('invisible' => array(":input[name='{$role_id}']" => array('checked' => FALSE))), '#attributes' => array('style' => 'margin-left: 2em'), '#default_value' => $profile_roles[$system_role->id()]['needs_approval']);
         }
     }
     $form['custom_mail'] = array('#type' => 'fieldset', '#title' => t('Custom registration email configuration'), '#collapsible' => TRUE);
     $form['custom_mail']['new_email'] = array("#type" => "textfield", "#title" => "Enter valid email");
     $form['custom_mail']['add_email'] = array("#type" => "button", "#value" => "Add email", "#ajax" => array('callback' => 'Drupal\\registration_role_with_approval\\Form\\RegistrationRoleWithApprovalSettingsForm::addEmailCallback', 'event' => 'click', 'effect' => 'fade', 'progress' => array('type' => 'throbber')));
     $form['custom_mail']['mailing_list'] = array("#type" => "textarea", "#title" => "Mailing list", "#default_value" => $mailing_list);
     $form['custom_mail']['email_subject'] = array("#type" => "textfield", "#title" => "Email subject", "#default_value" => $email_subject);
     $form['custom_mail']['email_body'] = array("#type" => "textarea", "#title" => "Email body", "#default_value" => $email_body);
     return parent::buildForm($form, $form_state);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:28,代码来源:RegistrationRoleWithApprovalSettingsForm.php

示例8: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Place the tabs and actions blocks as various tests use them.
     $this->drupalPlaceBlock('local_actions_block');
     $this->drupalPlaceBlock('local_tasks_block');
     // Collect admin permissions.
     $class = get_class($this);
     $adminPermissions = [];
     while ($class) {
         if (property_exists($class, 'adminPermissions')) {
             $adminPermissions = array_merge($adminPermissions, $class::$adminPermissions);
         }
         $class = get_parent_class($class);
     }
     // Enable a random selection of 8 countries so we're not always
     // testing with US and CA.
     $countries = \Drupal::service('country_manager')->getAvailableList();
     $country_ids = array_rand($countries, 8);
     foreach ($country_ids as $country_id) {
         // Don't use the country UI, we're not testing that here...
         Country::load($country_id)->enable()->save();
     }
     // Last one of the 8 gets to be the store default country.
     \Drupal::configFactory()->getEditable('uc_store.settings')->set('address.country', $country_id)->save();
     // Create a store administrator user account.
     $this->adminUser = $this->drupalCreateUser($adminPermissions);
     // Create a test product.
     $this->product = $this->createProduct(array('uid' => $this->adminUser->id(), 'promote' => 0));
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:33,代码来源:UbercartTestBase.php

示例9: testGetDefaultConfigLangcode

 /**
  * Tests getDefaultConfigLangcode().
  */
 public function testGetDefaultConfigLangcode()
 {
     // Install the Language module's configuration so we can use the
     // module_installer service.
     $this->installConfig(['language']);
     $this->assertNull(\Drupal::service('locale.config_manager')->getDefaultConfigLangcode('locale_test_translate.settings'), 'Before installing a module the locale config manager can not access the shipped configuration.');
     \Drupal::service('module_installer')->install(['locale_test_translate']);
     $this->assertEqual('en', \Drupal::service('locale.config_manager')->getDefaultConfigLangcode('locale_test_translate.settings'), 'After installing a module the locale config manager can get the shipped configuration langcode.');
     $simple_config = \Drupal::configFactory()->getEditable('locale_test_translate.simple_config_extra');
     $simple_config->set('foo', 'bar')->save();
     $this->assertNull(\Drupal::service('locale.config_manager')->getDefaultConfigLangcode($simple_config->getName()), 'Simple config created through the API is not treated as shipped configuration.');
     $block = Block::create(array('id' => 'test_default_config', 'theme' => 'classy', 'status' => TRUE, 'region' => 'content', 'plugin' => 'local_tasks_block', 'settings' => ['id' => 'local_tasks_block', 'label' => $this->randomMachineName(), 'provider' => 'core', 'label_display' => FALSE, 'primary' => TRUE, 'secondary' => TRUE]));
     $block->save();
     // Install the theme after creating the block as installing the theme will
     // install the block provided by the locale_test module.
     \Drupal::service('theme_installer')->install(['classy']);
     // The test_default_config block provided by the locale_test module will not
     // be installed because a block with the same ID already exists.
     $this->installConfig(['locale_test']);
     $this->assertNull(\Drupal::service('locale.config_manager')->getDefaultConfigLangcode('block.block.test_default_config'), 'The block.block.test_default_config is not shipped configuration.');
     // Delete the block so we can install the one provided by the locale_test
     // module.
     $block->delete();
     $this->installConfig(['locale_test']);
     $this->assertEqual('en', \Drupal::service('locale.config_manager')->getDefaultConfigLangcode('block.block.test_default_config'), 'The block.block.test_default_config is shipped configuration.');
     // Test the special case for configurable_language config entities.
     $fr_language = ConfigurableLanguage::createFromLangcode('fr');
     $fr_language->save();
     $this->assertEqual('en', \Drupal::service('locale.config_manager')->getDefaultConfigLangcode('language.entity.fr'), 'The language.entity.fr is treated as shipped configuration because it is a configurable_language config entity and in the standard language list.');
     $custom_language = ConfigurableLanguage::createFromLangcode('custom');
     $custom_language->save();
     $this->assertNull(\Drupal::service('locale.config_manager')->getDefaultConfigLangcode('language.entity.custom'), 'The language.entity.custom is not shipped configuration because it is not in the standard language list.');
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:36,代码来源:LocaleConfigManagerTest.php

示例10: testCheckoutAjax

 public function testCheckoutAjax()
 {
     // Enable two payment methods and set a condition on one.
     $this->createPaymentMethod('check');
     $other = $this->createPaymentMethod('other');
     // $this->addPaymentZoneCondition($other['id'], 'KS');
     // Specify that the billing zone should update the payment pane.
     $config = _uc_ajax_defaults('checkout');
     $config['panes][billing][address][zone'] = array('payment-pane' => 'payment-pane');
     \Drupal::configFactory()->getEditable('uc_cart.settings')->set('ajax.checkout', $config)->save();
     // Go to the checkout page, verify that the conditional payment method is
     // not available.
     $product = $this->createProduct(array('shippable' => 0));
     $this->addToCart($product);
     $this->drupalPostForm('cart', array('items[0][qty]' => 1), t('Checkout'));
     // @todo Re-enable when shipping quote conditions are available.
     // $this->assertNoEscaped($other['label']);
     // Change the billing zone and verify that payment pane updates.
     $edit = array();
     $edit['panes[billing][zone]'] = 'KS';
     $this->ucPostAjax(NULL, $edit, 'panes[billing][zone]');
     $this->assertEscaped($other['label']);
     $edit['panes[billing][zone]'] = 'AL';
     $this->ucPostAjax(NULL, $edit, 'panes[billing][zone]');
     // Not in Kansas any more...
     // @todo Re-enable when shipping quote conditions are available.
     // $this->assertNoEscaped($other['label']);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:28,代码来源:AjaxTest.php

示例11: submitForm

 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $config = \Drupal::configFactory()->getEditable('cors.config');
     $config->set('cors_domains', $form_state->getValue('settings'));
     $config->save();
     drupal_set_message(t('Configuration saved successfully!'), 'status', FALSE);
 }
开发者ID:nuxy,项目名称:cors,代码行数:7,代码来源:CorsConfigForm.php

示例12: setUp

 /**
  * Code run before each and every test method.
  */
 public function setUp()
 {
     parent::setUp();
     // Restore node to default value.
     $this->node = 1;
     // Create object with configuration.
     $this->config = \Drupal::configFactory()->getEditable('geshifilter.settings');
     // And set the path to the geshi library.
     $this->config->set('geshi_dir', '/libraries/geshi');
     // Create a content type, as we will create nodes on test.
     $settings = array('type' => 'geshifilter_content_type', 'name' => 'Geshifilter Content');
     $this->drupalCreateContentType($settings);
     // Create a filter admin user.
     $permissions = array('administer filters', 'administer nodes', 'access administration pages', 'create geshifilter_content_type content', 'edit any geshifilter_content_type content', 'administer site configuration');
     $this->filterAdminUser = $this->drupalCreateUser($permissions);
     // Log in with filter admin user.
     $this->drupalLogin($this->filterAdminUser);
     // Add an text format with only geshi filter.
     $this->createTextFormat('geshifilter_text_format', array('filter_geshifilter'));
     // Set some default GeSHi filter admin settings.
     // Set default highlighting mode to "do nothing".
     $this->config->set('default_highlighting', GeshiFilter::DEFAULT_PLAINTEXT);
     $this->config->set('use_format_specific_options', FALSE);
     $this->config->set('tag_styles', array(GeshiFilter::BRACKETS_ANGLE => GeshiFilter::BRACKETS_ANGLE, GeshiFilter::BRACKETS_SQUARE => GeshiFilter::BRACKETS_SQUARE));
     $this->config->set('default_line_numbering', GeshiFilter::LINE_NUMBERS_DEFAULT_NONE);
     $this->config->save();
 }
开发者ID:hugronaphor,项目名称:cornel,代码行数:30,代码来源:GeshiFilterTest.php

示例13: setup

 /**
  * {@inheritdoc}
  */
 protected function setup()
 {
     parent::setup();
     // Set extra fields
     \Drupal::configFactory()->getEditable('ds_extras.settings')->set('region_to_block', TRUE)->set('fields_extra', TRUE)->set('fields_extra_list', array('node|article|ds_extras_extra_test_field', 'node|article|ds_extras_second_field'))->save();
     \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:10,代码来源:LayoutClassesTest.php

示例14: testExposedFiltering

 /**
  * Tests if exposed filtering via AJAX works for the "Content" View.
  */
 public function testExposedFiltering()
 {
     // Enable AJAX on the /admin/content View.
     \Drupal::configFactory()->getEditable('views.view.content')->set('display.default.display_options.use_ajax', TRUE)->save();
     // Create a Content type and two test nodes.
     $this->createContentType(['type' => 'page']);
     $this->createNode(['title' => 'Page One']);
     $this->createNode(['title' => 'Page Two']);
     // Create a user privileged enough to use exposed filters and view content.
     $user = $this->drupalCreateUser(['administer site configuration', 'access content', 'access content overview']);
     $this->drupalLogin($user);
     // Visit the View page.
     $this->drupalGet('admin/content');
     $session = $this->getSession();
     // Ensure that the Content we're testing for is present.
     $html = $session->getPage()->getHtml();
     $this->assertContains('Page One', $html);
     $this->assertContains('Page Two', $html);
     // Search for "Page One".
     $this->submitForm(['title' => 'Page One'], t('Filter'));
     $this->waitForAjaxToFinish();
     // Verify that only the "Page One" Node is present.
     $html = $session->getPage()->getHtml();
     $this->assertContains('Page One', $html);
     $this->assertNotContains('Page Two', $html);
     // Search for "Page Two".
     $this->submitForm(['title' => 'Page Two'], t('Filter'));
     $this->waitForAjaxToFinish();
     // Verify that only the "Page Two" Node is present.
     $html = $session->getPage()->getHtml();
     $this->assertContains('Page Two', $html);
     $this->assertNotContains('Page One', $html);
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:36,代码来源:ExposedFilterAJAXTest.php

示例15: getDerivativeDefinitions

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {

    $custom_fields = \Drupal::configFactory()->listAll('ds.field.');

    foreach ($custom_fields as $config) {
      $field = \Drupal::config($config)->get();
      if ($field['type'] == $this->getType()) {
        foreach ($field['entities'] as $entity_type) {
          $key = $this->getKey($entity_type, $field);
          $this->derivatives[$key] = $base_plugin_definition;
          $this->derivatives[$key] += array(
            'title' => $field['label'],
            'properties' => $field['properties'],
            'entity_type' => $entity_type,
          );
          if (!empty($field['ui_limit'])) {
            $this->derivatives[$key]['ui_limit'] = explode("\n", $field['ui_limit']);
            // Ensure that all strings are trimmed, eg. don't have extra spaces,
            // \r chars etc.
            foreach ($this->derivatives[$key]['ui_limit'] as $k => $v) {
              $this->derivatives[$key]['ui_limit'][$k] = trim($v);
            }
          }
        }
      }
    }

    return $this->derivatives;
  }
开发者ID:jkyto,项目名称:agolf,代码行数:32,代码来源:DynamicField.php


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