本文整理汇总了PHP中s_err_arg函数的典型用法代码示例。如果您正苦于以下问题:PHP s_err_arg函数的具体用法?PHP s_err_arg怎么用?PHP s_err_arg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s_err_arg函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: s_smarty_tpl
function s_smarty_tpl($tpl, &$assign = false)
{
if (!is_file($tpl) || !is_readable($tpl)) {
return s_err_arg('no suce file of ' . $tpl);
}
$smarty = s_smarty_object();
try {
$smarty->assign($assign);
} catch (SmartyException $se) {
}
return $smarty->fetch($tpl);
}
示例2: s_smarty_tpl
function s_smarty_tpl($tpl)
{
if (!is_file($tpl) || !is_readable($tpl)) {
return s_err_arg('no suce file of ' . $tpl);
}
$smarty = s_smarty_object();
try {
return $smarty->fetch($tpl);
} catch (SmartyException $se) {
return s_log($se->getMessage());
}
}
示例3: s_weibo_by_wid
function s_weibo_by_wid($wid)
{
if (s_bad_id($wid)) {
return s_err_arg();
}
$key = 'weibo_by_wid#' . $wid;
if (false === ($data = s_memcache($key))) {
if (false === ($data = s_weibo_http('https://api.weibo.com/2/statuses/show.json', array('id' => $wid)))) {
return s_err_sdk();
}
//缓存
s_memcache($key, $data);
}
return $data;
}
示例4: s_badge_new
function s_badge_new($uid, $bid, $username, $password)
{
if (s_bad_id($uid) || s_bad_string($username) || s_bad_string($password)) {
return s_err_arg();
}
$key = 'badge_new_by#' . $uid . $bid . $username . $password;
if (false === ($data = s_memcache($key))) {
$data = array('source' => APP_KEY, 'badge_id' => $bid, 'uids' => $uid, '_username' => $username, '_password' => $password);
if ($data = s_badge_http('http://i2.api.weibo.com/2/proxy/badges/issue.json', $data, 'post')) {
//缓存一小时
s_memcache($key, $data, 3600);
}
}
return $data;
}
示例5: s_err_arg
function &s_watermark(&$photo, &$watermark, $x = 0, $y = 0)
{
if (s_bad_gd() || s_bad_string($photo) || s_bad_string($watermark)) {
return s_err_arg();
}
//获取底板图片和水印图片
if (false === ($plate = @imagecreatefromjpeg($photo)) || false === ($water = @imagecreatefrompng($watermark))) {
return s_err_log('image error.');
}
//计算水平间隔
//检查图片大小
$p_w = imagesx($plate);
$p_h = imagesy($plate);
$w_w = imagesx($water);
$w_h = imagesy($water);
if ($p_w < $w_w || $p_h < $w_h) {
//消毁对象
imagedestroy($plate);
imagedestroy($water);
return s_err_log('water height or width more than plate');
}
//TODO: 使用临时目录
$time = s_action_time();
$path = '/tmp/';
$path .= defined('APP_NAME') ? APP_NAME : date('Y-m-d', $time) . '_auto';
if (!is_dir($path) && !mkdir($path, 0755, true)) {
return false;
}
$file = $path . '/' . $time . '_' . rand(1, 10000) . '.jpg';
//合并图片
if (false === imagecopy($plate, $water, $p_w - $w_w, $p_h - $w_h, 0, 0, $w_w, $w_h) || false === imagejpeg($plate, $file)) {
return s_err_log('unsuccess to {$file}.');
}
//消毁对象
imagedestroy($plate);
imagedestroy($water);
//返回图片地址或者图片数据
return $file;
}
示例6: s_live_now
function s_live_now(&$user, $type = 1, $page = 1, $max = 10)
{
if (s_bad_array($user) || s_bad_id($page) || s_bad_id($type)) {
return s_err_arg();
}
$key = 'live_list_by#' . $page . $type . $max;
if (false === ($data = s_memcache($key))) {
$data = array('uid' => $user['uid'], 'type' => $type, 'page' => $page, 'pagesize' => $max);
if (false === ($data = s_live_http('http://i.service.t.sina.com.cn/sapps/live/getlivelist.php', $data))) {
return s_err_sdk();
}
//缓存60秒
s_memcache($key, $data, 60);
}
return $data;
}
示例7: _s_db_delete
function _s_db_delete($table, $v1)
{
if (s_bad_string($table, $table, true) || !($v1 = is_array($v1) && isset($v1["id"]) ? intval($v1["id"]) : $v1) || s_bad_id($v1)) {
return s_err_arg();
}
if (defined("APP_DB_PREFIX")) {
//替换表名:"%s_user:update" => "201204disney_user:update"
$table = sprintf($table, APP_DB_PREFIX, true);
}
$sql = "update `{$table}` set `status`=-1 where `id`= {$v1}";
return s_db_exec($sql);
}
示例8: s_user_ship
function s_user_ship($uid)
{
$data = array();
if (!s_bad_id($uid)) {
//微博ID
$data['target_id'] = $uid;
} else {
if (!s_bad_string($uid)) {
//微博昵称
$data['target_screen_name'] = $uid;
}
}
if (s_bad_array($data)) {
return s_err_arg();
}
//2.0接口返回程序未被授权
//return s_weibo_http("https://api.weibo.com/2/friendships/create.json", $data, "post");
return s_weibo_http("http://api.t.sina.com.cn/friendships/show.json", $data);
}
示例9: s_weibo_search
function s_weibo_search($sid, $uid = false, $key = false, $page = 1, $size = 10, $istag = 0, $sort = 'time', $start = false, $end = false)
{
if (s_bad_string($sid)) {
return s_err_arg();
}
//看cache中是否存在
$mkey = "weibo_search#" . 'uid=' . $uid . 'key=' . $key . 'page=' . $page . 'size=' . $size . 'istag=' . $istag . 'sort=' . $sort . 'start=' . $start . 'end=' . $end . 'sid=' . $sid;
if (false === ($data = s_memcache($mkey))) {
//缓存中没有,请求服务器
$params = array('sid' => $sid, 'page' => $page, 'count' => $size);
if (is_string($key)) {
$params['q'] = $key;
}
if (!s_bad_0id($istag)) {
$params['istag'] = $istag;
}
if (!s_bad_id($uid)) {
$params['uid'] = $uid;
}
if (!s_bad_id($start)) {
$params['starttime'] = $start;
}
if (!s_bad_id($end)) {
$params['endtime'] = $end;
}
if (false === ($data = s_weibo_http('http://i2.api.weibo.com/2/search/statuses.json', $params))) {
return false;
}
//缓存起来60秒
s_memcache($mkey, $data, 60);
}
return $data;
}
示例10: _s_user_friends
function _s_user_friends($uid, $count = 200, $page = 1)
{
if (s_bad_id($count) || s_bad_id($page)) {
return s_err_arg();
}
if (!s_bad_id($uid)) {
//微博ID
$data['uid'] = $uid;
} else {
if (!s_bad_string($uid)) {
//微博昵称
$data['screen_name'] = $uid;
}
}
$data['count'] = $count > 5000 ? 200 : $count;
//游标从0开始
$data['cursor'] = $page - 1;
$key = "user_followers_by_uid#{$uid}_{$count}_{$page}";
if (false !== ($users = s_memcache($key))) {
return $users;
}
//缓存中没有,从微博平台中获取
if (false === ($ret = s_weibo_http("https://api.weibo.com/2/friendships/followers.json", $data)) || s_bad_array($ret['users'])) {
return false;
}
$users = s_user_sample($ret['users']);
//缓存中存储起来
s_memcache($key, $users);
return $users;
}