当前位置: 首页>>代码示例>>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;未经允许,请勿转载。