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


PHP SaeStorage::errno方法代码示例

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


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

示例1: SaeStorage

 /**
  * 用flash添加照片
  */
 function add_photo()
 {
     if ($_FILES) {
         global $php;
         $php->upload->thumb_width = 136;
         $php->upload->thumb_height = 136;
         $php->upload->max_width = 500;
         $php->upload->max_height = 500;
         $php->upload->thumb_qulitity = 100;
         if (class_exists('SaeStorage', false)) {
             $s = new SaeStorage();
             $file_id = uniqid('pic_', false) . mt_rand(1, 100);
             $tmp_file = SAE_TMP_PATH . '/thum_' . $file_id . '.jpg';
             Image::thumbnail($_FILES['Filedata']['tmp_name'], $tmp_file, $php->upload->thumb_width, $php->upload->thumb_height, $php->upload->thumb_qulitity, false);
             $pic = '/uploads/' . $file_id . ".jpg";
             $ret = $s->upload('static', $pic, $_FILES['Filedata']['tmp_name']);
             if ($ret) {
                 $data['picture'] = $s->getUrl('static', $pic);
             } else {
                 echo $s->errmsg() . ' : ' . $s->errno();
                 return;
             }
             $thum_pic = '/uploads/thum_' . $file_id . '.jpg';
             $ret = $s->upload('static', $thum_pic, $tmp_file);
             if ($ret) {
                 $data['imagep'] = $s->getUrl('static', $thum_pic);
             } else {
                 echo $s->errmsg() . ' : ' . $s->errno();
                 return;
             }
         } else {
             $php->upload->sub_dir = 'user_images';
             $up_pic = Swoole::$php->upload->save('Filedata');
             if (empty($up_pic)) {
                 return '上传失败,请重新上传! Error:' . $php->upload->error_msg;
             }
             $data['picture'] = $up_pic['name'];
             $data['imagep'] = $up_pic['thumb'];
         }
         $data['uid'] = $_POST['uid'];
         $up_pic['photo_id'] = $this->swoole->model->UserPhoto->put($data);
         /* if(isset($_POST['post']))
            {
            	Api::feed('photo', $data['uid'], 0, $up_pic['photo_id']);
            } */
         return json_encode($up_pic);
     } else {
         $this->swoole->tpl->display('myphoto_add_photo.html');
     }
 }
开发者ID:netstao,项目名称:swoole.com,代码行数:53,代码来源:myphoto.php

示例2: save

 /**
  * 保存指定文件
  * @param  array   $file    保存的文件信息
  * @param  boolean $replace 同名文件是否覆盖
  * @return boolean          保存状态,true-成功,false-失败
  */
 public function save($file, $replace = true)
 {
     $filename = ltrim($this->rootPath . '/' . $file['savepath'] . $file['savename'], '/');
     $st = new \SaeStorage();
     /* 不覆盖同名文件 */
     if (!$replace && $st->fileExists($this->domain, $filename)) {
         $this->error = '存在同名文件' . $file['savename'];
         return false;
     }
     /* 移动文件 */
     if (!$st->upload($this->domain, $filename, $file['tmp_name'])) {
         $this->error = '文件上传保存错误![' . $st->errno() . ']:' . $st->errmsg();
         return false;
     }
     return true;
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:22,代码来源:Sae.class.php

示例3: handleFiles

function handleFiles($typeId, $tmpNames, $names)
{
    global $IS_SAE;
    $result = array("success" => true, "details" => array());
    $ext_arr = array();
    for ($i = 0; $i < count($names); $i++) {
        $tmp = explode(".", $names[$i]);
        $tmp = $tmp[count($tmp) - 1];
        array_push($ext_arr, $tmp);
    }
    // when name the folder, here we wipe the parameter $type.
    $directory = "../resources/chart/{$typeId}/";
    if ($IS_SAE) {
        $st = new SaeStorage();
        $attr = array('encoding' => 'gzip');
        for ($i = 0; $i < count($names); $i++) {
            $tName = $tmpNames[$i];
            $oName = $names[$i];
            $file_new_name = date("YmdHis") . str_pad(rand(0, 9999), 4, rand(0, 9), STR_PAD_LEFT) . "." . $ext_arr[$i];
            $uploadRes = $st->upload($_SERVER['HTTP_APPNAME'], $file_new_name, $_FILES['photo']['tmp_name'][$i], $attr, true);
            if ($uploadRes === false) {
                array_push($result["details"], array("success" => false, "msg" => "图片'{$oName}'上传失败!error:" . $st->errno() . ' ' . $st->errmsg(), "file" => '', "original_file_name" => $oName));
            } else {
                array_push($result["details"], array("success" => true, "msg" => "图片'{$oName}'上传成功!重命名为'{$file_new_name}'。", "file" => $uploadRes, "original_file_name" => $oName));
            }
        }
    } else {
        if (!file_exists($directory)) {
            if (!mkdir($directory)) {
                throw new Exception("文件夹创建失败!" . $directory);
            }
        }
        for ($i = 0; $i < count($names); $i++) {
            $tName = $tmpNames[$i];
            $oName = $names[$i];
            $file_new_name = date("YmdHis") . str_pad(rand(0, 9999), 4, rand(0, 9), STR_PAD_LEFT) . "." . $ext_arr[$i];
            if (move_uploaded_file($tName, $directory . $file_new_name)) {
                array_push($result["details"], array("success" => true, "msg" => "图片'{$oName}'上传成功!重命名为'{$file_new_name}'。", "file" => $directory . $file_new_name, "original_file_name" => $oName));
            } else {
                array_push($result["details"], array("success" => false, "msg" => "图片'{$oName}'上传失败!", "file" => '', "original_file_name" => $oName));
            }
        }
    }
    return $result;
}
开发者ID:hxghxg527,项目名称:FamilyDecoration,代码行数:45,代码来源:upload.php

示例4: save

  }
  /**
 * 保存指定文件
 * @param  array   $file    保存的文件信息
 * @param  boolean $replace 同名文件是否覆盖
 * @return boolean          保存状态,true-成功,false-失败
 */
  public function save(&$file, $replace = true)
  {
      $filename = ltrim($this->rootPath . '/' . $file['save_path'] . $file['save_name'], '/');
      $st = new \SaeStorage();
      /* 不覆盖同名文件 */
      if (!$replace && $st->fileExists($this->domain, $filename)) {
          $this->error = '存在同名文件' . $file['savename'];
          return false;
      }
      /* 移动文件 */
      if (!$st->upload($this->domain, $filename, $file['tmp_name'])) {
          $this->error = '文件上传保存错误![' . $st->errno() . ']:' . $st->errmsg();
开发者ID:RqHe,项目名称:aunet1,代码行数:19,代码来源:Sae.class.php

示例5: define

 static function upload_topic($pic_name, $change = 0, $oldpic = null)
 {
     define('DOMAIN', 'upload');
     //要上传的storage名称定义
     $temp = 'temp';
     $s = new SaeStorage();
     $poc = array('_big.jpg', '_midde.jpg', '_small.jpg', '.jpg');
     foreach ($poc as $p) {
         $pic = $pic_name . $p;
         $img = $s->read($temp, $pic);
         if ($s->write(DOMAIN, $pic, $img) == false) {
             echo "图片写入失败!请重新上传,如果还是失败请联系客服!但是不要放弃对咱们原创的希望";
             var_dump($s->errno(), $s->errmsg());
         }
         unset($pic);
         unset($pics);
         unset($img);
     }
     self::delete_topic($pic_name);
     if ($change == 1) {
         self::delete_topic($oldpic, 'jpg', 'upload');
     }
     unset($s);
     return 1;
 }
开发者ID:acsiiii,项目名称:leeeframework,代码行数:25,代码来源:img.php

示例6: SaeStorage

<?php

// 参考: http://apidoc.sinaapp.com/class-SaeStorage.html
// 顺便吐槽下,居然没有 createDomain() 的接口,需要开发者手工创建一个 upload 的 domain
// 虽然 SAE 很有争议,但是还是有很多开发者想玩一玩,XN3 只需要一个文件配置文件就搞定。正式运营环境建议使用 VPS 或者独立服务器。
if (IN_SAE) {
    $saestorage = new SaeStorage();
    //$saestorage->setDomainAttr('domain', array('private'=>'false'));
    $n = $saestorage->getDomainCapacity('upload');
    //if($n == NULL || $saestorage->errno() == -7) exit('SaeStorage upload 磁盘配额不足!');
    if ($n == NULL || $saestorage->errno()) {
        exit($saestorage->errmsg());
    }
    $conf['db'] = array('type' => 'mysql', 'mysql' => array('master' => array('host' => SAE_MYSQL_HOST_M . (SAE_MYSQL_PORT == 3306 ? '' : ':' . SAE_MYSQL_PORT), 'user' => SAE_MYSQL_USER, 'password' => SAE_MYSQL_PASS, 'name' => SAE_MYSQL_DB, 'charset' => 'utf8', 'engine' => 'MyISAM'), 'slaves' => array()));
    $conf['upload_url'] = $saestorage->geturl('upload', '') . '/';
    $conf['upload_path'] = 'saestor://upload/';
    $conf['tmp_path'] = SAE_TMP_PATH;
}
// 函数如果放在 if 里面不利于 opcode 缓存。
/*function sae_move_upload_file($srcfile, $destfile) {
	global $saestorage;
	return $saestorage->upload('upload', $srcfile, $destfile);
}*/
开发者ID:xiuno,项目名称:xiunobbs,代码行数:23,代码来源:sae.conf.php

示例7: SaeStorageErrorNumber

function SaeStorageErrorNumber()
{
    //无错误则为0
    $storage = new SaeStorage();
    $result = $storage->errno();
    return $result;
}
开发者ID:ribunkou,项目名称:MyPHP,代码行数:7,代码来源:SaeStorage.php

示例8: date

 // 图片消息
 if ($form_MsgType == "image") {
     // 获取发送图片的URL
     $form_PicUrl = $postObj->PicUrl;
     // 创建新图片的名称
     $filename = $fromUsername . date("YmdHis") . ".jpg";
     // 建立抓取图片类
     $f = new SaeFetchurl();
     // 抓取图片
     $res = $f->fetch($form_PicUrl);
     // 如果抓取到图片
     if ($f->errno() == 0) {
         // 新建存储类
         $s = new SaeStorage();
         $s->write("kingson4wu", $filename, $res);
         if ($s->errno() == 0) {
             $msgType = "text";
             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $msgType, "Upload Success!");
             echo $resultStr;
         } else {
             $msgType = "text";
             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $msgType, "Save failed!");
             echo $resultStr;
         }
     } else {
         $msgType = "text";
         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(), $msgType, "Upload failed!");
         echo $resultStr;
     }
     exit;
 }
开发者ID:Kingson4Wu,项目名称:Kingson4WeixinOnSae,代码行数:31,代码来源:wx_kingson4wu.php

示例9: write

 /**
  * Write a query to a cache file
  *
  * @access	public
  * @return	bool
  */
 function write($sql, $object)
 {
     if (!$this->check_path()) {
         return $this->db->cache_off();
     }
     $segment_one = $this->CI->uri->segment(1) == FALSE ? 'default' : $this->CI->uri->segment(1);
     $segment_two = $this->CI->uri->segment(2) == FALSE ? 'index' : $this->CI->uri->segment(2);
     //---chang---//
     /*
     		$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';
     
     		$filename = md5($sql);
     
     		if ( ! @is_dir($dir_path))
     		{
     			if ( ! @mkdir($dir_path, DIR_WRITE_MODE))
     			{
     				return FALSE;
     			}
     
     			@chmod($dir_path, DIR_WRITE_MODE);
     		}
     
     		if (write_file($dir_path.$filename, serialize($object)) === FALSE)
     		{
     			return FALSE;
     		}
     
     		@chmod($dir_path.$filename, FILE_WRITE_MODE);
     */
     $file_name = $segment_one . '-' . $segment_two . '-' . md5($sql);
     if ($this->db->cache_method == "storage") {
         $storage = new SaeStorage();
         $storage->write($this->db->cachedir, $file_name, serialize($object));
         if ($storage->errno() != 0) {
             return FALSE;
         }
     } else {
         $mmc = memcache_init();
         if ($mmc) {
             $catalog_data = memcache_get($mmc, $this->db->cachedir);
             $catalog;
             if ($catalog_data == false) {
                 $catalog = array();
             } else {
                 $catalog = unserialize($catalog_data);
             }
             if (!array_key_exists($file_name, $catalog)) {
                 $catalog[$file_name] = "";
                 memcache_set($mmc, $this->db->cachedir, serialize($catalog));
             }
             memcache_set($mmc, $file_name, serialize($object));
         } else {
             return false;
         }
     }
     return TRUE;
 }
开发者ID:ruoyousi,项目名称:MyFunds-sae,代码行数:64,代码来源:DB_cache.php


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