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


PHP Ftp::forge方法代码示例

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


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

示例1: action_ajax_test_ftp

 public function action_ajax_test_ftp()
 {
     // is ajax
     if (!\Input::is_ajax()) {
         \Response::redirect(\Uri::create('admin'));
     }
     // check permission
     if (\Model_AccountLevelPermission::checkAdminPermission('config_global', 'config_global') == false) {
         \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
         return null;
     }
     if (\Input::method() == 'POST') {
         // get post value and test connection
         $config['hostname'] = trim(\Input::post('hostname'));
         $config['username'] = trim(\Input::post('username'));
         $config['password'] = trim(\Input::post('password'));
         $config['port'] = (int) trim(\Input::post('port'));
         $config['passive'] = trim(\Input::post('passive')) == 'true' ? true : false;
         $config['ssl_mode'] = false;
         $config['debug'] = false;
         $basepath = trim(\Input::post('basepath'));
         // connect to ftp
         $ftp = \Ftp::forge($config);
         $ftp->connect();
         $ftp->change_dir($basepath);
         $files = $ftp->list_files();
         $ftp->close();
         $output = array();
         if ($files !== false) {
             $output['form_status'] = 'success';
             $output['form_status_message'] = \Lang::get('config_ftp_connected_check_basepath_from_dir_structure_below');
             natsort($files);
             $output['list_files'] = '<ul>';
             foreach ($files as $file) {
                 $output['list_files'] .= '<li>' . $file . '</li>';
             }
             $output['list_files'] .= '</ul>';
         } else {
             // got false from list_files means cannot connect
             $output['form_status'] = 'error';
             $output['form_status_message'] = \Lang::get('config_ftp_could_not_connect_to_server');
         }
         // clear no use variables
         unset($basepath, $config, $file, $files, $ftp);
         // send out json values
         $response = new \Response();
         $response->set_header('Content-Type', 'application/json');
         $response->body(json_encode($output));
         return $response;
     }
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:51,代码来源:config.php

示例2: with_ftp

 /**
  * Upload files with Ftp
  *
  * @param   string|array  The name of the config group to use, or a configuration array.
  * @param   bool          Automatically connect to this server.
  */
 public static function with_ftp($config = 'default', $connect = true)
 {
     static::$with_ftp = \Ftp::forge($config, $connect);
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:10,代码来源:upload.php

示例3: with_ftp

 /**
  * Upload files with FTP
  *
  * @param
  *        	string|array The name of the config group to use, or a configuration array.
  * @param
  *        	bool Automatically connect to this server.
  */
 public static function with_ftp($config = 'default', $connect = true)
 {
     if (static::$with_ftp = \Ftp::forge($config, $connect)) {
         // if we have an ftp object, activate the move callback
         static::$upload->setConfig('moveCallback', '\\Upload\\move_callback');
     } else {
         // creating the ftp object failed, disable the callback
         static::$upload->setConfig('moveCallback', null);
     }
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:18,代码来源:upload.php


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