本文整理匯總了PHP中Func::unescape方法的典型用法代碼示例。如果您正苦於以下問題:PHP Func::unescape方法的具體用法?PHP Func::unescape怎麽用?PHP Func::unescape使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Func
的用法示例。
在下文中一共展示了Func::unescape方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getSageList
/**
* 獲取智囊圖列表
* @param int $mem_id 用戶id
* @param string $mem_mark 單點標識
* @param int $page_id 分頁頁碼
* @param int $limit 每頁條數
* @return int|array
*/
public function getSageList($mem_id, $mem_mark, $page_id = 1, $limit = 20)
{
//單點查詢
$member_exists = $this->singleMember($mem_id, $mem_mark);
if ($member_exists != OK) {
return $member_exists;
}
//查詢智囊
$sql = 'select mem_id,mem_head,mem_nickname,mem_answers,mem_fine
from member
where mem_is_sage=1 and mem_status=1
order by mem_fine desc,mem_answers desc';
$list = $this->pagination($sql, [], 'mem_id', $page_id, $limit);
//處理數據
$mem_ides = '';
$data = [];
if ($list['list']) {
foreach ($list['list'] as $key => $val) {
//智囊頭像
$val['mem_head'] = Func::setImg($val['mem_head']);
//反轉義數據
$val['mem_nickname'] = Func::unescape($val['mem_nickname']);
//用智囊id當數據鍵
$val['tags'] = [];
$data[$val['mem_id']] = $val;
//提取提問id
$tmp = $key == 0 ? '' : ',';
$mem_ides .= "{$tmp}{$val['mem_id']}";
}
//查詢智囊標簽
$sql = "select p1.mem_id,p2.tag_name from tag_adept p1 inner join tag p2 on p1.tag_id=p2.tag_id where p1.mem_id in ({$mem_ides})";
$tags = $this->fetchAll($sql);
if ($tags) {
foreach ($tags as $val) {
if (isset($data[$val['mem_id']])) {
$data[$val['mem_id']]['tags'][] = $val['tag_name'];
}
}
}
}
$list['list'] = $data;
return $list;
}
示例2: getQuestionInfo
/**
* 獲取提問列表
* @param int $que_id 提問id
* @return mixed 失敗返回int,成功返回array
*/
public function getQuestionInfo($que_id)
{
//查詢數據
$sql = "select p1.que_id,p1.mem_id,p1.que_content,p1.que_img,p1.que_reward,p1.que_answers,p1.que_addtime,\n p2.mem_head,p2.mem_nickname,p2.mem_rong_id\n from question p1\n inner join member p2 on p1.mem_id=p2.mem_id\n where p1.que_is_hidden=1 and p1.que_status=2 and p2.mem_status=1 and p1.que_id=?";
$question = $this->fetchOne($sql, [$que_id]);
if (!$question) {
return NOT_FOUND_DATA;
}
//查詢標簽
$question['tags'] = [];
$sql = 'select p2.tag_name from question_tag p1 inner join tag p2 on p1.tag_id=p2.tag_id where p1.que_id=?';
$tags = $this->fetchAll($sql, [$que_id]);
if ($tags) {
foreach ($tags as $val) {
$question['tags'][] = $val['tag_name'];
}
}
//處理數據
$question['mem_head'] = Func::setImg($question['mem_head']);
$question['mem_nickname'] = Func::unescape($question['mem_nickname']);
$question['que_content'] = Func::unescape($question['que_content']);
$question['que_img'] = json_decode($question['que_img'], true);
if ($question['que_img']) {
foreach ($question['que_img'] as $key => $val) {
$question['que_img'][$key] = Func::setImg($val);
}
}
return $question;
}
示例3: codeLogin
/**
* 手機驗證碼登陸
* @param string $pho_phone 手機號
* @param int $pho_code 驗證碼
* @param int $login_system 操作係統
* @param string $login_number 手機序列號
* @param string $mem_client_id 推送key
* @return int|array
*/
public function codeLogin($pho_phone, $pho_code, $login_system, $login_number, $mem_client_id)
{
//手機驗證碼驗證
$phone_status = $this->verifyPhoneCode($pho_phone, $pho_code);
if ($phone_status != OK) {
return $phone_status;
}
//查詢用戶信息
$field = 'mem_id,mem_status,mem_online,mem_mark,mem_nickname,mem_head,mem_sex,mem_is_sage,mem_questions,
mem_answers,mem_fine,mem_gold,mem_on_system,mem_on_user,mem_rong_id,mem_rong_token';
$sql = "select {$field} from member where mem_phone=?";
$member = $this->fetchOne($sql, [$pho_phone]);
//判斷手機是否注冊
if (!$member) {
return NOT_FOUND_USER;
}
//賬號狀態
if ($member['mem_status'] != 1) {
return USER_AUTHORITY_ERROR;
}
//添加登陸信息
$login_status = $this->addLoginLog($member, $login_system, $login_number, $mem_client_id);
if ($login_status != OK) {
return $login_status;
}
//銷毀無用字段
unset($member['mem_status']);
unset($member['mem_online']);
//格式化
$member['mem_head'] = Func::setImg($member['mem_head']);
//翻轉義昵稱
$member['mem_nickname'] = Func::unescape($member['mem_nickname']);
return $member;
}