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


PHP Settings::setZipClass方法代碼示例

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


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

示例1: testZipArchive

 /**
  * Test all methods
  *
  * @param string $zipClass
  * @covers ::<public>
  */
 public function testZipArchive($zipClass = 'ZipArchive')
 {
     // Preparation
     $existingFile = __DIR__ . '/../_files/documents/sheet.xls';
     $zipFile = __DIR__ . '/../_files/documents/ziptest.zip';
     $destination1 = __DIR__ . '/../_files/documents/extract1';
     $destination2 = __DIR__ . '/../_files/documents/extract2';
     @mkdir($destination1);
     @mkdir($destination2);
     Settings::setZipClass($zipClass);
     $object = new ZipArchive();
     $object->open($zipFile, ZipArchive::CREATE);
     $object->addFile($existingFile, 'xls/new.xls');
     $object->addFromString('content/string.txt', 'Test');
     $object->close();
     $object->open($zipFile);
     // Run tests
     $this->assertEquals(0, $object->locateName('xls/new.xls'));
     $this->assertFalse($object->locateName('blablabla'));
     $this->assertEquals('Test', $object->getFromName('content/string.txt'));
     $this->assertEquals('Test', $object->getFromName('/content/string.txt'));
     $this->assertFalse($object->getNameIndex(-1));
     $this->assertEquals('content/string.txt', $object->getNameIndex(1));
     $this->assertFalse($object->extractTo('blablabla'));
     $this->assertTrue($object->extractTo($destination1));
     $this->assertTrue($object->extractTo($destination2, 'xls/new.xls'));
     $this->assertFalse($object->extractTo($destination2, 'blablabla'));
     // Cleanup
     $this->deleteDir($destination1);
     $this->deleteDir($destination2);
     @unlink($zipFile);
 }
開發者ID:HaiLeader,項目名稱:quizz,代碼行數:38,代碼來源:ZipArchiveTest.php

示例2: testSetGetZipClass

 /**
  * Test set/get zip class
  */
 public function testSetGetZipClass()
 {
     $this->assertEquals(Settings::ZIPARCHIVE, Settings::getZipClass());
     $this->assertTrue(Settings::setZipClass(Settings::PCLZIP));
     $this->assertFalse(Settings::setZipClass('foo'));
 }
開發者ID:kaantunc,項目名稱:MYK-BOR,代碼行數:9,代碼來源:SettingsTest.php


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