本文整理汇总了PHP中Mobile::directory_search方法的典型用法代码示例。如果您正苦于以下问题:PHP Mobile::directory_search方法的具体用法?PHP Mobile::directory_search怎么用?PHP Mobile::directory_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile
的用法示例。
在下文中一共展示了Mobile::directory_search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// Initialize the search results array, in case the API fails
$search_results = array();
// Let's get our results
$search_results = Mobile::directory_search($search_query);
// Assign the search results array to the template
$app->tpl->assign('results', $search_results);
// Display the template
$app->tpl->assign('show_page', 'directory-results');
$app->tpl->display('_wrapper.tpl');
});
// Let's get the details of the person
respond('GET', '/user/[:username]/?', function ($request, $response, $app) {
// Get the search parameter from the request (url encode it... it may contain spaces, etc)
$username = $request->param('username');
// Let's get our results
$user_details = Mobile::directory_search($username);
// If there was more than one result, someone didn't use this correctly
if (count($user_details) > 1) {
// We'll let it work anyway, but let's warn the developer
$_SESSION['warnings'][] = 'More than 1 result returned. Username may have been too ambiguous.';
}
// Assign the user_details object to the template
$app->tpl->assign('user_data', $user_details[0]);
});
// Let's get the details of the person
respond('POST', '/user/[:username]/?', function ($request, $response, $app) {
// Get the user detail data from the request. That way we can save an API call.
$user_details = json_decode(stripslashes($request->param('user-details')));
// Assign the user_details object to the template
$app->tpl->assign('user_data', $user_details);
});