本文整理匯總了PHP中UserList::getCategories方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserList::getCategories方法的具體用法?PHP UserList::getCategories怎麽用?PHP UserList::getCategories使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserList
的用法示例。
在下文中一共展示了UserList::getCategories方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: function
header('Content-Type: text/javascript; charset=utf8');
header('Access-Control-Allow-Origin: ' . $base_url . '/');
header('Access-Control-Max-Age: 3628800');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
with('/api/version', function () {
respond('GET', '/?', function ($request, $response) {
global $api_version, $app_version, $webapp_version;
$version = ['api_version' => $api_version, 'app_version' => $app_version, 'webapp_version' => $webapp_version];
$output = json_encode($version, JSON_PRETTY_PRINT);
echo $output;
});
});
with('/api/category', function () {
respond('GET', '/?', function ($request, $response) {
$list = new UserList();
$selection = $list->getCategories(20);
$output = json_encode($selection, JSON_PRETTY_PRINT);
echo $output;
});
respond('GET', '/[:id]', function ($request, $response) {
// Show items from a single category
$id = $request->id;
$list = new UserList();
$selection = $list->getCategoriesList(20, $id);
$output = json_encode($selection, JSON_PRETTY_PRINT);
echo $output;
});
});
with('/api/items', function () {
respond('GET', '/?', function ($request, $response) {
$list = new UserList();
示例2: testListing
public function testListing()
{
$selection = UserList::getCategories(20);
$this->assertEquals(count($selection), 6);
}