本文整理汇总了PHP中SaeStorage::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeStorage::getUrl方法的具体用法?PHP SaeStorage::getUrl怎么用?PHP SaeStorage::getUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeStorage
的用法示例。
在下文中一共展示了SaeStorage::getUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if ($_GET['fp'] != 1 && $_COOKIE['tennis-club'] != null) {
$this->redirect('Index:index_' . $_COOKIE['tennis-club']);
}
$s = new SaeStorage();
$waiting = "";
$city_id = $_GET['cityId'];
// 设置数组
$currentProvince = array();
$provinceList = array();
$cityList = array();
$clubList = array();
// 定义数据库查询变量
$PROVINCE = M('province');
$CITY = M('city');
$CLUB = M('club');
// 查询省市列表
$provinceList = $PROVINCE->getField("province_id, province_id, province_name");
if ($city_id == null) {
// 获取打开页面者所在城市
$city = $this->getIPCity();
// 查询数据库获取城市列表
$province = $CITY->where("city_name like '%" . $city . "%'")->join("INNER JOIN province ON province.province_id=city.province_id")->getField('city_id, city_id, city_name, city.province_id, province_name');
$currentProvince = current($province);
$cityList = $CITY->where('province_id=' . $currentProvince['province_id'])->getField('city_id, city_id, city_name');
// 查询俱乐部列表
$clubList = $CLUB->where("city_id=" . $currentProvince['city_id'])->getField("id, id, name");
if ($clubList != null) {
foreach ($clubList as $key => $value) {
$clubList[$key]['portrait'] = $s->getUrl("imgdomain", 'club_portrait/club' . $value['id'] . '.jpg');
}
} else {
$waiting = "等待当地俱乐部入驻。。。";
}
} else {
$province = $CITY->where("city_id=" . $city_id)->join("INNER JOIN province ON province.province_id=city.province_id")->getField('city_id, city_id, city_name, city.province_id, province_name');
$currentProvince = current($province);
$cityList = $CITY->where('province_id=' . $currentProvince['province_id'])->getField('city_id, city_id, city_name');
// 查询俱乐部列表
$clubList = $CLUB->where("city_id=" . $currentProvince['city_id'])->getField("id, id, name");
if ($clubList != null) {
foreach ($clubList as $key => $value) {
$clubList[$key]['portrait'] = $s->getUrl("imgdomain", 'club_portrait/club' . $value['id'] . '.jpg');
}
} else {
$waiting = "等待当地俱乐部入驻。。。";
}
}
$this->assign("currentProvinceId", $currentProvince['province_id']);
$this->assign("currentProvinceName", $currentProvince['province_name']);
$this->assign("currentCityId", $currentProvince['city_id']);
$this->assign("currentCityName", $currentProvince['city_name']);
$this->assign("provinceList", $provinceList);
$this->assign("cityList", $cityList);
$this->assign("clubList", $clubList);
$this->assign("waiting", $waiting);
$this->display();
}
示例2: 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');
}
}
示例3: SaeStorage
function s_get_url($filepath)
{
$_s = new SaeStorage();
//初始化Storage对象
$_f = _s_get_path($filepath);
return $_s->getUrl($_f['domain'], $_f['filename']);
}
示例4: actionImageManager
public function actionImageManager()
{
$path = "data/editor/image/" . Ibos::app()->user->uid;
$action = EnvUtil::getRequest("action");
if ($action == "get") {
if (!defined("SAE_TMP_PATH")) {
$files = $this->getfiles($path);
if (!$files) {
return null;
}
rsort($files, SORT_STRING);
$str = "";
foreach ($files as $file) {
$str .= "../../../../../../" . $file . "ue_separate_ue";
}
echo $str;
} else {
$st = new SaeStorage();
$num = 0;
while ($ret = $st->getList("data", $path, 100, $num)) {
foreach ($ret as $file) {
if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
echo $st->getUrl("data", $file) . "ue_separate_ue";
}
$num++;
}
}
}
}
}
示例5: Storage_Return_Url
/**
* @param $upload
* @return null
*/
function Storage_Return_Url($upload)
{
global $zbp, $domainname;
$file = new Upload();
$file = $zbp->GetUploadByID($upload->ID);
$s = new SaeStorage();
$url = $s->getUrl($domainname, $file->Metas->Storage_URL);
return $url;
}
示例6: upload_mp3
function upload_mp3($filePath, $fileName)
{
$stor = new SaeStorage();
$stor->upload(SAE_DOMAIN, $fileName, $filePath);
$errmsg = $stor->errmsg();
//var_export($errmsg);
if ($errmsg == 0) {
$result['success'] = 1;
$result['url'] = $stor->getUrl(SAE_DOMAIN, $fileName);
} else {
$result['success'] = -1;
}
return $result;
}
示例7: photo
public function photo()
{
$photo = M('photo');
$s = new SaeStorage();
$path = $photo->where('id=' . $_GET['id'])->getField('path');
$list = $s->getListByPath('imgdomain', $path);
$files = $list["files"];
$imgUrlList = array();
foreach ($files as $imageFile) {
$imgUrl = $s->getUrl("imgdomain", $path . "/" . $imageFile['Name']);
array_push($imgUrlList, $imgUrl);
}
$this->assign('list', $imgUrlList);
$this->display();
}
示例8: storage
public function storage()
{
$s = new SaeStorage();
$s->write('Public', 'example/thebook', 'bookcontent');
//写入文件
$ret = $s->read('Public', 'example/thebook');
//读取文件
dump($ret);
$ret = $s->getUrl('Public', 'example/thebook');
//获得地址
dump($ret);
}
示例9: array
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: luofei614 <weibo.com/luofei614>
// +----------------------------------------------------------------------
/**
* SAE模式惯例配置文件
* 该文件请不要修改,如果要覆盖惯例配置的值,可在应用配置文件中设定和惯例不符的配置项
* 配置名称大小写任意,系统会统一转换成小写
* 所有配置参数都可以在生效前动态改变
*/
defined('THINK_PATH') or exit;
$st = new SaeStorage();
return array('DB_TYPE' => 'mysql', 'DB_DEPLOY_TYPE' => 1, 'DB_RW_SEPARATE' => true, 'DB_HOST' => SAE_MYSQL_HOST_M . ',' . SAE_MYSQL_HOST_S, 'DB_NAME' => SAE_MYSQL_DB, 'DB_USER' => SAE_MYSQL_USER, 'DB_PWD' => SAE_MYSQL_PASS, 'DB_PORT' => SAE_MYSQL_PORT, 'TMPL_PARSE_STRING' => array('/Public/upload' => $st->getUrl('public', 'upload')), 'LOG_TYPE' => 'Sae', 'DATA_CACHE_TYPE' => 'Memcachesae', 'CHECK_APP_DIR' => false, 'FILE_UPLOAD_TYPE' => 'Sae', 'PICTURE_UPLOAD_DRIVER' => 'Sae', 'UPLOAD_SAE_CONFIG' => array('rootPath' => 'http://' . $_SERVER['HTTP_APPNAME'] . '-uploads.stor.sinaapp.com/Editor/', 'domain' => 'uploads'), 'EDITOR_UPLOAD' => array('rootPath' => 'http://' . $_SERVER['HTTP_APPNAME'] . '-uploads.stor.sinaapp.com/Editor/', 'domain' => 'uploads'));
示例10: SerialMatch_detail
public function SerialMatch_detail()
{
// 获取系列赛id
$id = $_GET['id'];
$players = array();
$scale_html = "";
if ($id == null || $id == '') {
$this->error('无有效参数!');
}
$s = new SaeStorage();
// 获取基本情况
$ACTIVITY = M('activity');
$activity0 = $ACTIVITY->where('id=' . $id)->getField('title, content, start_time, end_time, headcount, cover, scale_num, result, champion_id');
$activity = current($activity0);
if ($activity['cover'] != 1 || $s->fileExists("imgdomain", 'post/' . $id . '.jpg') == FALSE) {
$activity['cover'] = "__IMG__/activity.jpg";
} else {
$activity['cover'] = $s->getUrl("imgdomain", 'post/' . $id . '.jpg');
}
// 获取积分榜数据
$ACTIVITY_USER = M('activity_user');
$activity_user = $ACTIVITY_USER->join('INNER JOIN serial_match_user ON serial_match_user.serial_match_id=activity_user.activity_id and serial_match_user.user_id=activity_user.user_id and activity_user.activity_id=' . $id . ' and serial_match_user.round=1 and type=0')->join('INNER JOIN user ON user.id=activity_user.user_id')->order('serial_match_user.group,score desc,win desc,activity_user.offset desc')->getField('truename,activity_user.round,win,lost,offset,activity_user.score,group,no');
$score_list = null;
if ($activity_user != null) {
$this->assign('exist1', 1);
$index = -1;
$subIndex = 0;
$group = '';
foreach ($activity_user as $key => $value) {
if ($group != $value['group']) {
$index++;
$subIndex = 0;
$group = $value['group'];
$score_list[$index]['group'] = $group;
}
$score_list[$index]['player'][$subIndex]['index'] = $subIndex + 1;
$score_list[$index]['player'][$subIndex]['truename'] = $value['truename'];
$score_list[$index]['player'][$subIndex]['win'] = $value['win'];
$score_list[$index]['player'][$subIndex]['lost'] = $value['lost'];
$score_list[$index]['player'][$subIndex]['offset'] = $value['offset'];
$score_list[$index]['player'][$subIndex]['score'] = $value['score'];
$score_list[$index]['player'][$subIndex]['round'] = $value['round'];
$score_list[$index]['player'][$subIndex]['no'] = $group . $value['no'];
$subIndex++;
}
}
// 获取小组赛对阵
$BASE_MATCH = M('base_match');
$base_match = $BASE_MATCH->join(' INNER JOIN serial_base_match ON serial_base_match.serial_match_id=' . $id . ' and serial_base_match.base_match_id=base_match.id and serial_base_match.type=0 and serial_base_match.serial_match_id=' . $id)->join(' INNER JOIN serial_match_user ON serial_match_user.serial_match_id=' . $id . ' and serial_base_match.player1_id = serial_match_user.user_id and serial_match_user.type=0')->order('serial_match_user.group, state desc,start_date')->getField('base_match.id, group, state, score, start_date, end_date, player1_id, player2_id, round1, round2');
$SERIAL_MATCH_USER = M('serial_match_user');
$user_no = $SERIAL_MATCH_USER->where('serial_match_id=' . $id . ' and round=1 and type=0')->join('INNER JOIN user ON user.id=serial_match_user.user_id')->getField('user_id, truename, no');
$group_list = null;
if ($base_match != null) {
$this->assign('exist2', 1);
$index = -1;
$subIndex = 0;
$group = '';
foreach ($base_match as $key => $value) {
if ($group != $value['group']) {
$index++;
$subIndex = 0;
$group = $value['group'];
$group_list[$index]['group'] = $group;
}
if ($value['state'] == 0) {
$group_list[$index]['players'][$subIndex]['state'] = '未开始';
} else {
$group_list[$index]['players'][$subIndex]['state'] = '已结束';
}
$group_list[$index]['players'][$subIndex]['start_date'] = $value['start_date'];
$group_list[$index]['players'][$subIndex]['end_date'] = $value['end_date'];
$group_list[$index]['players'][$subIndex]['vs'] = $user_no[$value['player1_id']]['truename'] . '【' . $value['score'] . '】' . $user_no[$value['player2_id']]['truename'];
$group_list[$index]['players'][$subIndex]['round'] = '[' . $value['round1'] . ',' . $value['round2'] . ']';
$group_list[$index]['players'][$subIndex]['no1'] = $user_no[$value['player1_id']]['no'];
$group_list[$index]['players'][$subIndex]['no2'] = $user_no[$value['player2_id']]['no'];
$subIndex++;
}
}
// 获得淘汰赛对阵
$SERIAL_MATCH_USER1 = M('serial_match_user');
$user_name = $SERIAL_MATCH_USER1->where('serial_match_id=' . $id . ' and round=1 and type=1')->join('INNER JOIN user ON user.id=serial_match_user.user_id')->getField('user_id, truename, no');
$base_match = $BASE_MATCH->join(' INNER JOIN serial_base_match ON serial_base_match.base_match_id=base_match.id and serial_base_match.type=1 and serial_base_match.serial_match_id=' . $id)->order('state desc,start_date')->getField('base_match.id, state, score, start_date, end_date, player1_id, player2_id, round1, round2,group1,group2,no1,no2');
foreach ($base_match as $key => $value) {
// 人员信息设置
if ($value['player1_id'] > 0) {
$player1 = $user_name[$value['player1_id']]['truename'];
} else {
if ($value['player1_id'] == 0) {
$player1 = "轮空";
} else {
$player1 = "待出线";
}
}
if ($value['player2_id'] > 0) {
$player2 = $user_name[$value['player2_id']]['truename'];
} else {
if ($value['player2_id'] == 0) {
$player2 = "轮空";
} else {
$player2 = "待出线";
//.........这里部分代码省略.........
示例11: array
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: luofei614 <weibo.com/luofei614>
// +----------------------------------------------------------------------
/**
* SAE模式惯例配置文件
* 该文件请不要修改,如果要覆盖惯例配置的值,可在应用配置文件中设定和惯例不符的配置项
* 配置名称大小写任意,系统会统一转换成小写
* 所有配置参数都可以在生效前动态改变
*/
defined('THINK_PATH') or exit;
$st = new SaeStorage();
return array('DB_TYPE' => 'mysql', 'DB_DEPLOY_TYPE' => 1, 'DB_RW_SEPARATE' => true, 'DB_HOST' => SAE_MYSQL_HOST_M . ',' . SAE_MYSQL_HOST_S, 'DB_NAME' => SAE_MYSQL_DB, 'DB_USER' => SAE_MYSQL_USER, 'DB_PWD' => SAE_MYSQL_PASS, 'DB_PORT' => SAE_MYSQL_PORT, 'TMPL_PARSE_STRING' => array('/Public/upload' => $st->getUrl('public', 'upload'), '/Public/AUSrc' => $st->getUrl('public', 'AUSrc'), '/Public/general' => $st->getUrl('public', 'general'), '/Public/NewsSrc' => $st->getUrl('public', 'NewsSrc'), '/Public/FAQSrc' => $st->getUrl('public', 'FAQSrc'), '/Public/js' => $st->getUrl('public', 'js'), '/Public/OtherSrc' => $st->getUrl('public', 'OtherSrc')), 'LOG_TYPE' => 'Sae', 'DATA_CACHE_TYPE' => 'Memcachesae', 'CHECK_APP_DIR' => false, 'FILE_UPLOAD_TYPE' => 'Sae');
示例12: action_thumb
public function action_thumb($attachmentId = false)
{
if (!($attachment = $this->getAttachment($attachmentId))) {
return;
}
$model = ET::getInstance("attachmentModel");
//$path = $model->path().$attachmentId.$attachment["secret"];
$path = $model->path() . $attachmentId . '_' . $attachment["filename"];
//$thumb = $path."_thumb";
$thumb = $model->path() . 'thumb_' . $attachmentId . '_' . $attachment["filename"];
$thumb_encode = $model->path() . urlencode('thumb_' . $attachmentId . '_' . $attachment["filename"]);
if (!file_exists(PATH_SAESTOR . $thumb)) {
try {
$uploader = ET::uploader();
$thumb = $uploader->saveAsImage(PATH_SAESTOR . $path, $thumb, 400, 300, "max");
//$newThumb = substr($thumb, 0, strrpos($thumb, "."));
//rename($thumb, $newThumb);
//$thumb = $newThumb;
} catch (Exception $e) {
return;
}
}
//in SAE
$s = new SaeStorage();
if ($s->fileExists(SAESTOR_DOMAIN, $thumb)) {
$url = $s->getUrl(SAESTOR_DOMAIN, $thumb_encode);
redirect($url);
} else {
$this->render404(T("message.attachmentNotFound"), true);
return false;
}
//header('Content-Type: '.$model->mime($attachment["filename"]));
//echo file_get_contents($thumb);
}
示例13: array
<?php
defined('THINK_PATH') or exit;
$st = new SaeStorage();
return array('DB_TYPE' => 'mysqli', 'DB_DEPLOY_TYPE' => 1, 'DB_RW_SEPARATE' => true, 'DB_HOST' => SAE_MYSQL_HOST_M . ',' . SAE_MYSQL_HOST_S, 'DB_NAME' => SAE_MYSQL_DB, 'DB_USER' => SAE_MYSQL_USER, 'DB_PWD' => SAE_MYSQL_PASS, 'DB_PORT' => SAE_MYSQL_PORT, 'TMPL_PARSE_STRING' => array('./Public/upload' => $st->getUrl('public', 'upload'), '__PUBLIC__' => SCRIPT_DIR . '/Public', '__STATIC__' => SCRIPT_DIR . '/Public/static'), 'LOG_TYPE' => 'Sae', 'DATA_CACHE_TYPE' => 'Memcachesae', 'CHECK_APP_DIR' => false, 'FILE_UPLOAD_TYPE' => 'Sae');
示例14: file_domain
function file_domain($domain = '')
{
if (!IS_SAE) {
return '';
}
$s = new SaeStorage();
return rtrim($s->getUrl($domain, ''), '/');
}
示例15: serialMatch_release_presubmit
public function serialMatch_release_presubmit()
{
// 检查提交的比赛是否符合提交条件
if ($_POST['ensureArrange'] == 1) {
for ($i = 1; $i <= $groupNum; $i++) {
// 循环组
for ($j = 1; $j < $eachGroupAmount;) {
// 组内循环成员
if ($_POST[$groupArray[$i] . $j] == null || $_POST[$groupArray[$i] . $j] == '') {
$this->error('有部分球员未安排赛事,请重新安排!');
}
}
}
}
// 获取系列赛id
$id0 = $_GET['id'];
$groupNum = $_POST['groupNum'];
$type = $_GET['type'];
if ($id0 == null || $id0 == '') {
$this->error('无有效参数!');
}
$s = new SaeStorage();
// 获取基本情况
$ACTIVITY = M('activity');
$activity0 = $ACTIVITY->where('id=' . $id0)->getField('id, title, content, start_time, end_time, headcount, cover, scale_num, state, result, champion_id');
$activity = current($activity0);
if ($activity['cover'] != 1 || $s->fileExists("imgdomain", 'post/' . $id0 . '.jpg') == FALSE) {
$activity['cover'] = "__IMG__/activity.jpg";
} else {
$activity['cover'] = $s->getUrl("imgdomain", 'post/' . $id0 . '.jpg');
}
// 赛事安排类型
$matchArrangeType = 0;
// 0表示小组赛,1表示淘汰赛,2表示超出系统安排范围
// 参赛总人数
$ACTIVITY = M('activity');
$headcount = $ACTIVITY->where('id=' . $_GET['id'])->GetField('headcount');
// 如果是淘汰赛,计算系统预设的分组数、每组人数和轮空数
$groupNum = 0;
$eachGroupAmount = 0;
$groupVoidArray = array();
// 轮空数组
$groupArray = array("1" => "A", "2" => "B", "3" => "C", "4" => "D", "5" => "E", "6" => "F", "7" => "G", "8" => "H");
$groupRoundNum = 0;
// 淘汰赛
if ($type == 1) {
$matchArrangeType = 1;
if ($headcount <= 8) {
$groupNum = 2;
$diff = 8 - $headcount;
// 轮空数
$eachGroupAmount = 4;
$groupRoundNum = 2;
$scaleNum = 8;
} else {
if ($headcount <= 16) {
$groupNum = 2;
$diff = 16 - $headcount;
// 轮空数
$eachGroupAmount = 8;
$groupRoundNum = 3;
$scaleNum = 16;
} else {
if ($headcount <= 32) {
$groupNum = 4;
$diff = 32 - $headcount;
// 轮空数
$eachGroupAmount = 8;
$groupRoundNum = 3;
$scaleNum = 32;
} else {
if ($headcount <= 64) {
$groupNum = 4;
$diff = 64 - $headcount;
// 轮空数
$eachGroupAmount = 16;
$groupRoundNum = 4;
$scaleNum = 64;
} else {
if ($headcount <= 128) {
$groupNum = 8;
$diff = 128 - $headcount;
// 轮空数
$eachGroupAmount = 16;
$groupRoundNum = 4;
$scaleNum = 128;
} else {
if ($headcount <= 256) {
$groupNum = 8;
$diff = 256 - $headcount;
// 轮空数
$eachGroupAmount = 32;
$groupRoundNum = 5;
$scaleNum = 256;
} else {
$matchArrangeType = 2;
}
}
}
}
//.........这里部分代码省略.........