本文整理汇总了PHP中search::setRequestFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP search::setRequestFrom方法的具体用法?PHP search::setRequestFrom怎么用?PHP search::setRequestFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::setRequestFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
if (!empty($_POST)) {
$accountId = isset($_POST['accountId']) ? $_POST['accountId'] : '';
$accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
$query = isset($_POST['query']) ? $_POST['query'] : '';
$userId = isset($_POST['userId']) ? $_POST['userId'] : 0;
$gender = isset($_POST['gender']) ? $_POST['gender'] : -1;
$online = isset($_POST['online']) ? $_POST['online'] : -1;
$ageFrom = isset($_POST['ageFrom']) ? $_POST['ageFrom'] : 13;
$ageTo = isset($_POST['ageTo']) ? $_POST['ageTo'] : 110;
$query = helper::clearText($query);
$query = helper::escapeText($query);
$userId = helper::clearInt($userId);
if ($gender != -1) {
$gender = helper::clearInt($gender);
}
if ($online != -1) {
$online = helper::clearInt($online);
}
$ageFrom = helper::clearInt($ageFrom);
$ageTo = helper::clearInt($ageTo);
$result = array("error" => true, "error_code" => ERROR_UNKNOWN);
$auth = new auth($dbo);
if (!$auth->authorize($accountId, $accessToken)) {
api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
}
$search = new search($dbo);
$search->setRequestFrom($accountId);
$result = $search->query($query, $userId, $gender, $online, $ageFrom, $ageTo);
echo json_encode($result);
exit;
}