本文整理汇总了PHP中SaeStorage::getCDNUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeStorage::getCDNUrl方法的具体用法?PHP SaeStorage::getCDNUrl怎么用?PHP SaeStorage::getCDNUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeStorage
的用法示例。
在下文中一共展示了SaeStorage::getCDNUrl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
/**
* 上传头像
*/
function upload($_FILES)
{
$username = $_GET['username'];
$files = $_FILES['file'];
$filename = $files['name'];
//获取图片名字
$fileResource = $files['tmp_name'];
$storage = new SaeStorage();
$domain = "userinfo";
if ($storage->fileExists($domain, $filename)) {
$storage->delete($domain, $filename);
}
if ($storage->upload($domain, $filename, $fileResource)) {
$imgUrl = $storage->getCDNUrl($domain, $filename);
//获取图片地址
//执行修改语句,将图片URl地址及图片名字写入数据库
$update = "update `user` set `imgName`='{$filename}', `imgUrl`='{$imgUrl}' where `username`='{$username}'";
$result = mysql_query($update);
//if(mysql_affected_rows()!=0){
echo "上传成功";
//}
} else {
echo "上传失败,错误信息:" . $storage->errmsg();
}
}
示例2: SaeStorage
<?php
$bed = new SaeStorage();
$domain = 'lwqqbed';
if ($_POST) {
$user = $_POST['user'];
$file = $_FILES['name']['tmp_name'];
$suffix = strstr($_FILES['name']['name'], '.');
$time = $user . microtime(true);
$dest = md5($user . "{$time}") . $suffix;
$result = $bed->upload($domain, $dest, $file, -1);
echo "{$result}";
}
if ($_GET) {
$image = $bed->getCDNUrl($domain, $_GET['id']);
header("Location: " . $image);
}
示例3: SaeStorageCDN
function SaeStorageCDN($FilePath)
{
//类似:http://moonlord-moonlord.stor.sinaapp.com/1.txt
$storage = new SaeStorage();
$domain = Sae_Storage_Domain_Name;
$result = $storage->getCDNUrl($domain, $FilePath);
return $result;
}
示例4: readModule
<button <?php
echo $editAble ? '' : 'disabled=true';
?>
type="button" onclick="postModule();" class="btn btn-primary center-block">
<span class="glyphicon glyphicon-ok"></span> 提交
</button>
</div>
</div>
<div class="row form_row1">
<div class="col-md-10">
<p class="help-block">你可以通过上传文件来替换下列代码。替换后无法恢复,请谨慎操作!</p>
</div>
<div class="col-md-2 pull-right">
<a target="_blank" href="<?php
echo $stor->getCDNUrl("xssrat", "modules/" . $module->m_path);
?>
" ><span class="label label-info"><i class="glyphicon glyphicon-download"></i> 下载</span></a>
</div>
</div>
<div class="row form_row">
<div class="col-md-12">
<pre>
<?php
echo readModule($module->m_path);
?>
</pre>
</div>
</div>
示例5: SaeStorage
/*
* 用户上传头像
*/
require_once "connect.php";
$username = $_GET['username'];
//获取用户姓名
$storage = new SaeStorage();
$domain = "userinfo";
if (!empty($_FILES)) {
$files = $_FILES['file'];
$filename = $files['name'];
//获取图片名字
$fileResource = $files['tmp_name'];
if ($storage->fileExists($domain, $filename)) {
$storage->delete($domain, $filename);
}
if ($storage->upload($domain, $filename, $fileResource)) {
$imgUrl = $storage->getCDNUrl($domain, $filename);
//获取图片地址
//执行修改语句,将图片URl地址及图片名字写入数据库
$update = "update `user` set `imgName`='{$filename}', `imgUrl`='{$imgUrl}' where `username`='{$username}'";
$result = mysql_query($update);
if (mysql_affected_rows() != 0) {
echo "上传成功";
}
} else {
echo "上传失败,错误信息:" . $storage->errmsg();
}
} else {
echo "文件未找到";
}