當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mapper::select方法代碼示例

本文整理匯總了PHP中Mapper::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mapper::select方法的具體用法?PHP Mapper::select怎麽用?PHP Mapper::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mapper的用法示例。


在下文中一共展示了Mapper::select方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: login

 function login()
 {
     if (!empty($_POST)) {
         $check = new Check();
         $user = new User();
         $pdo = new Db();
         $db = $pdo->get();
         $mapper = new Mapper($db);
         //Проверяем входные данные
         $user->login = $check->checkInput($_POST['login']);
         $password = $check->checkInput($_POST['pass']);
         $user->password = md5($password);
         //Если пользователь не найден
         $this->user = $mapper->select($user);
         if (empty($this->user)) {
             $this->error = "Пароль или логин не совпадают";
             $this->out('login.php');
         } else {
             $this->out('profile.php');
             //Если найден, выводим профиль
         }
     } else {
         $this->out('login.php');
     }
 }
開發者ID:toppestkek,項目名稱:Test,代碼行數:25,代碼來源:ctrlIndex.php

示例2: selectTag

 /**
  * 
  * @param boolean $all_
  * @return stdClass
  * @throws InvalidArgumentException
  */
 public function selectTag($all_ = false)
 {
     try {
         $where = null;
         if (is_null($this->table)) {
             throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
         }
         if (isset($this->id) && !is_null($this->id)) {
             $where = 'id = ' . $this->id;
         }
         return parent::select($this->table, $where, $object = new Tag(), $all_);
     } catch (InvalidArgumentException $e) {
         print $e->getMessage();
         exit;
     }
 }
開發者ID:noxa02,項目名稱:REST_ANNONCE,代碼行數:22,代碼來源:TagMapper.class.php

示例3: selectIncoming

 /**
  * 
  * @param boolean $all_
  * @return stdClass
  * @throws InvalidArgumentException
  */
 public function selectIncoming($all_ = false)
 {
     try {
         $where = null;
         if (is_null($this->table)) {
             throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
         }
         if (isset($this->foreignTable) && !is_null($this->foreignTable)) {
             $fkName = 'id_' . strtolower($this->foreignTable->getTable());
             $where = $fkName . ' = ' . $this->foreignTable->getId();
         } elseif (isset($this->id) && !is_null($this->id)) {
             $where = 'id = ' . $this->id;
         }
         return parent::select($this->table, $where, $object = new Incoming(), $all_);
     } catch (InvalidArgumentException $e) {
         print $e->getMessage();
         exit;
     }
 }
開發者ID:noxa02,項目名稱:REST_ANNONCE,代碼行數:25,代碼來源:IncomingMapper.class.php

示例4: function

<?php

$app->get('/', function () use($app) {
    $main = 'active';
    $add = '';
    $pdo = new Db();
    $db = $pdo->get();
    $mapper = new Mapper($db);
    $data = $mapper->select();
    $dir = '';
    return $app['twig']->render('index.twig', array('main' => $main, 'add' => $add, 'data' => $data, 'dir' => $dir));
})->bind('homepage');
$app->post('/', function () use($app) {
    if (isset($_POST['likeOption']) || isset($_POST['dateOption'])) {
        $main = 'active';
        $add = '';
        $pdo = new Db();
        $db = $pdo->get();
        $comments = new Comments();
        $check = new Check();
        if (isset($_POST['likeOption'])) {
            $order = $check->checkInput(htmlspecialchars($_POST['likeOption']));
            $comments->orderby = 'likes';
        }
        if (isset($_POST['dateOption'])) {
            $order = $check->checkInput(htmlspecialchars($_POST['dateOption']));
            $comments->orderby = 'date';
        }
        $mapper = new Mapper($db);
        if ($order == 'ASC') {
            $data = $mapper->searchAsc($comments);
開發者ID:toppestkek,項目名稱:GuestBook,代碼行數:31,代碼來源:index.php

示例5: getTags

 public function getTags()
 {
     $tag = new Tag();
     $where = 'id_announcement = ' . $this->getFirstId();
     return parent::select('TO_ASSOCIATE', $where, $tag);
 }
開發者ID:noxa02,項目名稱:REST_ANNONCE,代碼行數:6,代碼來源:AnnouncementMapper.class.php

示例6: Db

 $add = '';
 $pdo = new Db();
 $db = $pdo->get();
 $mapper = new Mapper($db);
 $comments = new Comments();
 $comments->id = $id;
 $data = $mapper->selectId($comments);
 if (empty($data)) {
     $app->abort(404, "Comment {$id} does not exist.");
 }
 if ($id == 1) {
     $first = 0;
 } else {
     $first = 1;
 }
 $all = count($mapper->select());
 if ($id == $all) {
     $last = 0;
 } else {
     $last = 1;
 }
 $next = $id + 1;
 $previous = $id - 1;
 $dir = '../';
 if (isset($_POST['id'])) {
     $itemid = $_POST['id'];
     $ip_address = $_SERVER['REMOTE_ADDR'];
     if (empty($app['session']->get($itemid))) {
         $app['session']->set($itemid, array('ip' => $ip_address, 'likes' => 0));
         $app['session.storage.options'] = ['cookie_lifetime' => 3600 * 7];
     }
開發者ID:toppestkek,項目名稱:GuestBook,代碼行數:31,代碼來源:comment.php


注:本文中的Mapper::select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。