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


PHP Ftp::read方法代碼示例

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


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

示例1: testInstantiable

 public function testInstantiable()
 {
     $adapter = new Ftp($this->options);
     $this->assertEquals('example.org', $adapter->getHost());
     $this->assertEquals(40, $adapter->getPort());
     $this->assertEquals(true, $adapter->getSsl());
     $this->assertEquals(35, $adapter->getTimeout());
     $this->assertEquals('/somewhere/', $adapter->getRoot());
     $this->assertEquals(0777, $adapter->getPermPublic());
     $this->assertEquals(00, $adapter->getPermPrivate());
     $this->assertEquals(false, $adapter->getPassive());
     $this->assertEquals('user', $adapter->getUsername());
     $this->assertEquals('password', $adapter->getPassword());
     $listing = $adapter->listContents('', true);
     $this->assertInternalType('array', $listing);
     $this->assertFalse($adapter->has('not.found'));
     $this->assertFalse($adapter->getVisibility('not.found'));
     $this->assertFalse($adapter->getSize('not.found'));
     $this->assertFalse($adapter->getMimetype('not.found'));
     $this->assertFalse($adapter->getTimestamp('not.found'));
     $this->assertFalse($adapter->write('write.fail', 'contents'));
     $this->assertFalse($adapter->writeStream('write.fail', tmpfile()));
     $this->assertFalse($adapter->update('write.fail', 'contents'));
     $this->assertFalse($adapter->setVisibility('chmod.fail', 'private'));
     $this->assertTrue($adapter->rename('a', 'b'));
     $this->assertTrue($adapter->delete('a'));
     $result = $adapter->read('something.txt');
     $this->assertEquals('contents', $result['contents']);
     $result = $adapter->getMimetype('something.txt');
     $this->assertEquals('text/plain', $result['mimetype']);
     $this->assertFalse($adapter->createDir('some.nested/mkdir.fail'));
     $this->assertInternalType('array', $adapter->write('unknowndir/file.txt', 'contents', 'public'));
     $this->assertInternalType('array', $adapter->writeStream('unknowndir/file.txt', tmpfile(), 'public'));
     $adapter->deleteDir('');
     $this->assertInternalType('array', $adapter->getTimestamp('some/file.ext'));
 }
開發者ID:robertdamoc,項目名稱:flysystem,代碼行數:36,代碼來源:FtpTests.php

示例2: isFirewalled

 /**
  * Is this transfer method blocked by a server firewall?
  *
  * @param   array  $params  Any additional parameters you might need to pass
  *
  * @return  boolean  True if the firewall blocks connections to a known host
  */
 public static function isFirewalled(array $params = array())
 {
     try {
         $connector = new Ftp(array('host' => 'test.rebex.net', 'port' => 21, 'username' => 'demo', 'password' => 'password', 'directory' => '', 'ssl' => isset($params['ssl']) ? $params['ssl'] : false, 'passive' => true, 'timeout' => 5));
         $data = $connector->read('readme.txt');
         if (empty($data)) {
             return true;
         }
     } catch (\Exception $e) {
         return true;
     }
     return false;
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:20,代碼來源:Ftp.php


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