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


PHP File::save方法代碼示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     entity_create('field_storage_config', array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     entity_create('field_config', array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'bundle' => 'entity_test'))->save();
     file_unmanaged_copy(DRUPAL_ROOT . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = entity_create('file', array('uri' => 'public://example.jpg'));
     $this->image->save();
     $this->imageFactory = $this->container->get('image.factory');
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:10,代碼來源:ImageThemeFunctionTest.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     FieldStorageConfig::create(array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     FieldConfig::create(['entity_type' => 'entity_test', 'field_name' => 'image_test', 'bundle' => 'entity_test'])->save();
     file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = File::create(['uri' => 'public://example.jpg']);
     $this->image->save();
     $this->imageFactory = $this->container->get('image.factory');
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:10,代碼來源:ImageThemeFunctionTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('file', array('file_usage'));
     entity_create('field_storage_config', array('field_name' => 'file_test', 'entity_type' => 'entity_test', 'type' => 'file', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     entity_create('field_config', array('entity_type' => 'entity_test', 'field_name' => 'file_test', 'bundle' => 'entity_test'))->save();
     file_put_contents('public://example.txt', $this->randomMachineName());
     $this->file = entity_create('file', array('uri' => 'public://example.txt'));
     $this->file->save();
 }
開發者ID:nsp15,項目名稱:Drupal8,代碼行數:11,代碼來源:FileItemTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('file', array('file_usage'));
     FieldStorageConfig::create(array('field_name' => 'file_test', 'entity_type' => 'entity_test', 'type' => 'file', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     $this->directory = $this->getRandomGenerator()->name(8);
     FieldConfig::create(['entity_type' => 'entity_test', 'field_name' => 'file_test', 'bundle' => 'entity_test', 'settings' => array('file_directory' => $this->directory)])->save();
     file_put_contents('public://example.txt', $this->randomMachineName());
     $this->file = File::create(['uri' => 'public://example.txt']);
     $this->file->save();
 }
開發者ID:eigentor,項目名稱:tommiblog,代碼行數:12,代碼來源:FileItemTest.php


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