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


PHP UserDAO::selectAll方法代码示例

本文整理汇总了PHP中UserDAO::selectAll方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDAO::selectAll方法的具体用法?PHP UserDAO::selectAll怎么用?PHP UserDAO::selectAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserDAO的用法示例。


在下文中一共展示了UserDAO::selectAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: UserDAO

<?php

$userDAO = new UserDAO();
$app->get('/users/?', authorize(), function () use($userDAO) {
    header("Content-Type: application/json");
    echo json_encode($userDAO->selectAll(), JSON_NUMERIC_CHECK);
    exit;
});
$app->get('/users/self/?', authorize(), function () use($userDAO) {
    header("Content-Type: application/json");
    echo json_encode($userDAO->selectByUserId($_SESSION['user']['id']), JSON_NUMERIC_CHECK);
    exit;
});
$app->get('/users/:id/?', authorize(), function ($id) use($userDAO) {
    header("Content-Type: application/json");
    echo json_encode($userDAO->selectById($id), JSON_NUMERIC_CHECK);
    exit;
});
$app->get('/users/login/:mail/?', authorize(), function ($mail) use($userDAO) {
    header("Content-Type: application/json");
    echo json_encode($userDAO->selectByMail($mail), JSON_NUMERIC_CHECK);
    exit;
});
$app->post('/users/?', authorize(), function () use($app, $userDAO) {
    header("Content-Type: application/json");
    $post = $app->request->post();
    if (empty($post)) {
        $post = (array) json_decode($app->request()->getBody());
    }
    echo json_encode($userDAO->insert($post), JSON_NUMERIC_CHECK);
    exit;
开发者ID:jessjoanna,项目名称:Photochallenge,代码行数:31,代码来源:users.php

示例2: UserDAO

Pieces::getJSs();
?>
</head>
<body>

<?php 
Pieces::getHeader();
Pieces::getMenu();
?>

<div class="row">
    <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4"

    </div>
</div>

    <div class="row content">
        <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
        <?php 
$userDAO = new UserDAO();
echo "count - " . count($userDAO->selectAll());
?>
    </div>
</div>

<?php 
Pieces::getFooterMenu();
Pieces::getFooter();
?>
</body>
</html>
开发者ID:akbars95,项目名称:phpProjects,代码行数:31,代码来源:index.php

示例3: UserDAO

<?php

session_start();
$userDAO = new UserDAO();
$app->get('/users/?', function () use($userDAO) {
    header("Content-Type: application/json");
    $data = $userDAO->selectAll();
    $fail = "failed";
    foreach ($data as $key => $value) {
        unset($data[$key]['email']);
        unset($data[$key]['password']);
    }
    if (!empty($_SESSION['user'])) {
        echo json_encode($data, JSON_NUMERIC_CHECK);
    } else {
        echo json_encode($fail, JSON_NUMERIC_CHECK);
    }
    exit;
});
$app->get('/users/:id/?', function ($id) use($userDAO) {
    header("Content-Type: application/json");
    $data = $userDAO->selectById($id);
    foreach ($data as $key => $value) {
        unset($data['email']);
        unset($data['password']);
    }
    echo json_encode($data, JSON_NUMERIC_CHECK);
    exit;
});
$app->put('/users/:id/?', function ($id) use($app, $userDAO) {
    header("Content-Type: application/json");
开发者ID:BrilliantBen,项目名称:pinspiration,代码行数:31,代码来源:users.php


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