本文整理汇总了PHP中load_func函数的典型用法代码示例。如果您正苦于以下问题:PHP load_func函数的具体用法?PHP load_func怎么用?PHP load_func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_func函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkIsLogin
/**
* 检测登录
*
* @return bool|\Illuminate\Http\RedirectResponse
* @author yangyifan <yangyifanphp@gmail.com>
*/
private function checkIsLogin()
{
load_func('common');
$uid = is_admn_login();
return $uid <= 0 && header('location:' . action('Admin\\LoginController@getIndex'));
die;
}
示例2: send_to_swoole_server
function send_to_swoole_server($step, $targer, $params, $callback)
{
//加载函数库
load_func('instanceof');
$swoole_client = get_swoole_client();
return $swoole_client->send(json_encode(['step' => $step, 'targer' => $targer, 'params' => $params, 'callback' => $callback]) . config('swoole.package_eof'));
}
示例3: __construct
/**
* 构造方法
*
* @author yangyifan <yangyifanphp@gmail.com>
*/
public function __construct()
{
//加载函数库
load_func('common');
//获得导航数据
$this->getSearch();
}
示例4: getAllForSchemaOption
/**
* 获得全部文章分类--无限极分类(编辑菜单时选项)
*
* @descript 递归组合无限极分类,为了编辑页面和增加页面select 展示
* @param $name 表单name名称
* @param $id 当前id
* @return array
* @author yangyifan <yangyifanphp@gmail.com>
*/
public static function getAllForSchemaOption($name, $id = 0, $first = true)
{
//加载函数库
load_func('common');
$data = $id > 0 ? merge_tree_node(obj_to_array(self::where('id', '<>', $id)->where('user_info_id', '=', is_user_login())->where('deleted_at', '=', '0000-00-00 00:00:00')->get())) : merge_tree_node(obj_to_array(self::where('user_info_id', '=', is_user_login())->get()));
$first == true && array_unshift($data, ['id' => '0', $name => '顶级分类']);
return $data;
}
示例5: getSaveUserInfo
/**
* 保用用户信息到redis
*
* @param Requests $requests
* @author yangyifan <yangyifanphp@gmail.com>
*/
public function getSaveUserInfo(Request $requests)
{
$user_info = unserialize(urldecode($requests->get('user_info')));
//保存用户信息到redis hash表
load_func('instanceof,swoole');
//返回状态
get_redis()->hSet(config('config.user_list_hash_table'), $user_info->id, serialize($user_info)) != false ? $this->response(200, 'success') : $this->response(400, trans('response.save_user_info_to_redis_error'));
}
示例6: getUserForumCat
/**
* 获得当前栏目全部角色权限
*
* @param null $role_id
* @return mixed
* @author yangyifan <yangyifanphp@gmail.com>
*/
public static function getUserForumCat($forum_cat_id)
{
if (!empty($forum_cat_id)) {
//加载函数库
load_func('common');
return obj_to_array(DB::table('forum_access AS fa')->select('r.id', 'r.role_name')->join('role AS r', 'fa.role_id', '=', 'r.id')->where('fa.forum_cat_id', '=', $forum_cat_id)->get());
}
return false;
}
示例7: getIndex
/**
* 登录操作
*
* @return Response
* @author yangyifan <yangyifanphp@gmail.com>
*/
public function getIndex()
{
load_func('common');
//判断是否已经登录
if (is_admin_login() > 0) {
return redirect(url('admin/home'), 302);
}
return view('admin.login.login');
}
示例8: __construct
/**
* 构造方法
*
* @author yangyifan <yangyifanphp@gmail.com>
*/
public function __construct()
{
//加载函数库
load_func('common');
//检测是否登陆
$this->checkIsLogin();
//获得导航数据
$this->getSearch();
}
示例9: __construct
/**
* 构造方法
*
* @author yangyifan <yangyifanphp@gmail.com>
*/
public function __construct()
{
parent::__construct();
$this->disk = Storage::disk('qiniu');
//获得一块硬盘
//加载函数库
load_func('common');
//设置会员头像保存路径
$this->user_avatar_prefix = '/avatar/' . is_user_login() . '/';
}
示例10: saveUserSession
/**
* 写入用户信息到SESSION
*
* @param $user_info
* @author yangyifan <yangyifanphp@gmail.com>
*/
private static function saveUserSession($user_info)
{
//引入函数库
load_func('common');
$user_info = obj_to_array($user_info);
$user_info['admin_user_data'] = ['id' => $user_info['id'], 'email' => $user_info['email'], 'updated_at' => $user_info['updated_at']];
$user_info['sign'] = hash_user_sign($user_info['admin_user_data']);
Session::put('admin_info', $user_info);
Session::save();
}
示例11: saveUserAvatar
/**
* 保存用户头像
*
* @param $image
* @param null $user_id
* @return bool
*/
public static function saveUserAvatar($image, $user_id = null)
{
if (!empty($image)) {
//加载函数库
load_func('common');
$user_id = $user_id != null ? $user_id : is_user_login();
return self::where('id', '=', $user_id)->update(['face' => $image]);
}
return false;
}
示例12: addFriend
/**
* 添加好友
*
* @param $user_id
* @param $contents
* @author yangyifan <yangyifanphp@gmail.com>
*/
public static function addFriend($user_id, $contents = '')
{
//加载函数库
load_func('common');
$affected_id = DB::table('add_user')->insertGetId(['user_info_id' => is_user_login(), 'invitee' => $user_id, 'created_at' => date('Y-m-d H:i:s')]);
//发送私信
if ($affected_id > 0) {
LetterModel::sendLetter($user_id, trans('log.add_user_log', ['user_name' => Session::get('user_info.email'), 'contents' => $contents]));
}
}
示例13: postSocketFd
/**
* 获得用户web socket fd
*
* @param Request $request
*/
public function postSocketFd(Request $request)
{
$user_id = $request->get('id');
//加载函数库
load_func('instanceof,image');
//获得发送对象$fb
$user_info = unserialize(get_redis()->hGet(config('config.user_list_hash_table'), $user_id));
if (!empty($user_info)) {
$this->response(200, 'success', ['fd' => $user_info->web_socket_fd, 'name' => $user_info->user_name, 'face' => get_user_info_face($user_info->face)]);
} else {
$this->response(400, trans('response.save_user_socket_to_redis_error'));
}
}
示例14: checkIsLogin
/**
* 检测登录
*
* @return bool|\Illuminate\Http\RedirectResponse
* @author yangyifan <yangyifanphp@gmail.com>
*/
private function checkIsLogin()
{
//记载函数库
load_func('common');
$uid = is_user_login();
if ($uid <= 0 && Request::method() == 'POST') {
$this->response(400, trans('response.no_login'));
} else {
if ($uid <= 0) {
header('location:' . action('Home\\UserController@getLogin'));
die;
}
}
}
示例15: getUserChoseCagetory
/**
* 获得全部分类
*
* @return mixed
* @author yangyifan <yangyifanphp@gmail.com>
*/
public static function getUserChoseCagetory()
{
//加载函数库
load_func('common');
//获得当前用户全部新闻分类
$user_new_category_id = self::getUserCagetory();
$all_category = self::all();
if (!empty($all_category)) {
foreach ($all_category as &$category) {
$category->checked = in_array($category->id, $user_new_category_id) ? true : false;
}
}
$all_category = obj_to_array($all_category);
return array_to_obj(merge_tree_child_node($all_category));
}