本文整理汇总了PHP中CityApi::users_index方法的典型用法代码示例。如果您正苦于以下问题:PHP CityApi::users_index方法的具体用法?PHP CityApi::users_index怎么用?PHP CityApi::users_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CityApi
的用法示例。
在下文中一共展示了CityApi::users_index方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_json
echo '<h1>Get All Users</h1>';
$ca = new CityApi();
$ca->debug = true;
$ca->json = false;
/*
echo '<h2>Test: users_count</h2>';
$results = $ca->users_count('ljkd');
echo "<h2>results:</h2>";
echo '<pre>';
echo "Count:" . $results['count'];
echo '</pre>';
*/
// get page 1
$ca->debug = true;
$ca->json = false;
$results = $ca->users_index(array('page' => '1'));
$total_pages = $results['total_pages'];
$total_entries = $results['total_entries'];
$per_page = $results['per_page'];
echo "<h2>Got {$total_pages} pages, {$total_entries} users, {$per_page} per page</h2>";
echo '<h2>Formatted JSON results: </h2>';
echo '<pre>';
echo format_json(json_encode($results));
echo '</pre>';
// get remaining pages
for ($page = 2; $page <= $total_pages; $page++) {
$results = $ca->users_index(array('page' => $page));
echo "<h2>Page {$page}:</h2>";
echo '<h2>Formatted JSON results: </h2>';
echo '<pre>';
echo format_json(json_encode($results));
示例2: format_json
$ca->json = false;
$results = $ca->users_index(array('filter'=>'created_in_the_last_7_days', 'page'=>'1'));
var_dump($results);
echo '<br />';
$results = $ca->users_index(array('filter'=>'created_in_the_last_7_days'));
var_dump($results);
echo '<br />';
$results = $ca->users_index(array('page'=>'1'));
var_dump($results);
echo '<br />';
*/
$ca->debug = true;
$ca->json = true;
$results = $ca->users_index(array('page' => '1', 'filter' => 'created_in_the_last_7_days'));
echo '<h2>Formatted JSON results: </h2>';
echo '<pre>';
echo format_json($results);
echo '</pre>';
$results = $ca->users_index(array('filter' => 'created_in_the_last_7_days', 'page' => '1'));
echo '<h2>Formatted JSON results: </h2>';
echo '<pre>';
echo format_json($results);
echo '</pre>';
echo '</div>';
?>
</body>
</html>