当前位置: 首页>>代码示例>>PHP>>正文


PHP CityApi::users_index方法代码示例

本文整理汇总了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));
开发者ID:stormhillmedia,项目名称:stormhill_thecity,代码行数:31,代码来源:test-users-get-all.php

示例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>
开发者ID:stormhillmedia,项目名称:stormhill_thecity,代码行数:29,代码来源:test-users-index.php


注:本文中的CityApi::users_index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。