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


PHP static::query方法代碼示例

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


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

示例1: getQuery

 /**
  * getQuery
  *
  * @param bool $new
  *
  * @return  Query
  */
 public static function getQuery($new = false)
 {
     if (!static::$query || $new) {
         static::$query = new Query();
     }
     return static::$query;
 }
開發者ID:im286er,項目名稱:windwalker,代碼行數:14,代碼來源:AbstractQueryBuilder.php

示例2: getQuery

 /**
  * getQuery
  *
  * @param bool $new
  *
  * @return  \JDatabaseQuery
  */
 public static function getQuery($new = false)
 {
     if (!static::$query || $new) {
         static::$query = \JFactory::getDbo()->getQuery(true);
     }
     return static::$query;
 }
開發者ID:lyrasoft,項目名稱:lyrasoft.github.io,代碼行數:14,代碼來源:MysqlQueryBuilder.php

示例3: getTicketByID

 public static function getTicketByID($id)
 {
     $instance = new static();
     $sql = $instance->query("SELECT * FROM " . self::$table . " WHERE id=" . $id);
     if ($sql->execute()) {
         //$result_set =$sql->fetch(PDO::FETCH_ASSOC) ;
         $object_array = array();
         while ($row = $sql->fetch(\PDO::FETCH_ASSOC)) {
             $object_array[] = static::instantiate($row);
         }
         return !empty($object_array) ? array_shift($object_array) : false;
     }
 }
開發者ID:runningjack,項目名稱:busticketNew,代碼行數:13,代碼來源:Tickets.php

示例4: findByAppId

 public static function findByAppId($id)
 {
     $instance = new static();
     $sql = $instance->query("SELECT * FROM " . static::$table . " where app_id = '" . $id . "'");
     if ($sql->execute()) {
         //$result_set =$sql->fetch(PDO::FETCH_ASSOC) ;
         $object_array = array();
         while ($row = $sql->fetch(\PDO::FETCH_ASSOC)) {
             $object_array[] = static::instantiate($row);
         }
         return !empty($object_array) ? array_shift($object_array) : false;
     }
 }
開發者ID:runningjack,項目名稱:busticketAPI1,代碼行數:13,代碼來源:Merchant.php

示例5: __construct

    public function __construct()
    {
        // Because some hosts are complete
        // idiotic pieces of shit, let's
        // strip slashes from input.
        if (get_magic_quotes_gpc()) {
            $php_is_the_worst_language_ever_because_of_this = function (&$value) {
                $value = stripslashes($value);
            };
            array_walk_recursive($_GET, $php_is_the_worst_language_ever_because_of_this);
            array_walk_recursive($_POST, $php_is_the_worst_language_ever_because_of_this);
            array_walk_recursive($_COOKIE, $php_is_the_worst_language_ever_because_of_this);
            array_walk_recursive($_REQUEST, $php_is_the_worst_language_ever_because_of_this);
        }

        // Set query string
        static::$query = (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null);

        // Set request scheme
        static::$scheme = static::isSecure() ? 'https' : 'http';

        // Set host
        static::$host = strtolower(preg_replace('/:\d+$/', '', trim($_SERVER['SERVER_NAME'])));

        // Set base url
        static::$base = static::baseUrl();

        // Set the request path
        static::$request_uri = static::requestPath();

        // Set relative uri without query string
        $uri = explode('?', str_replace(static::$base, '', static::$request_uri));
        static::$uri = $uri[0];

        // Request segments
        static::$segments = explode('/', trim(static::$uri, '/'));

        // Set the request method
        static::$method = strtolower($_SERVER['REQUEST_METHOD']);

        // Requested with
        static::$requested_with = @$_SERVER['HTTP_X_REQUESTED_WITH'];

        // _REQUEST
        static::$request = $_REQUEST;

        // _POST
        static::$post = $_POST;
    }
開發者ID:nirix,項目名稱:avalon,代碼行數:49,代碼來源:request.php

示例6: init

 /**
  * Sets up the request.
  */
 public static function init()
 {
     static::$query = new ParameterBag($_GET);
     static::$post = new ParameterBag($_POST);
     static::$properties = new ParameterBag();
     static::$server = new ParameterBag($_SERVER);
     static::$headers = static::buildHeaderBag();
     static::$method = isset($_POST['_method']) ? $_POST['_method'] : $_SERVER['REQUEST_METHOD'];
     static::$requestUri = $_SERVER['REQUEST_URI'];
     static::$scriptName = $_SERVER['SCRIPT_NAME'];
     static::$basePath = rtrim(str_replace(basename(static::$scriptName), '', static::$scriptName), '/');
     static::$pathInfo = str_replace(static::$scriptName, '', static::$requestUri);
     static::$pathInfo = static::preparePathInfo();
     static::$segments = explode('/', trim(static::$pathInfo, '/'));
 }
開發者ID:nirix,項目名稱:unframework,代碼行數:18,代碼來源:Request.php

示例7: find_by_sql

 public static function find_by_sql($sql = "")
 {
     $instance = new static();
     $object_array = array();
     $sql = $instance->query($sql);
     if ($sql->execute()) {
         while ($row = $sql->fetch(\PDO::FETCH_ASSOC)) {
             $object_array[] = self::instantiate($row);
         }
         if ($object_array) {
             return $object_array;
         } else {
             return false;
         }
     }
 }
開發者ID:runningjack,項目名稱:busticketAPI1,代碼行數:16,代碼來源:Model.php

示例8: find

 /**
  * Find a model by its primary key.
  *
  * @param  string  $id
  * @param  array   $columns
  * @return Model
  */
 public static function find($id, $columns = array('*'))
 {
     $model = new static();
     return $model->query()->where(static::$key, '=', $id)->first($columns);
 }
開發者ID:simonfork,項目名稱:phpmark,代碼行數:12,代碼來源:model.php

示例9: delete

 public static function delete($text)
 {
     static::$query = null;
 }
開發者ID:reganhimself,項目名稱:KeeleProgrammers,代碼行數:4,代碼來源:profiler.php

示例10: all

 /**
  * Get all of the models from the database.
  *
  * @param  array  $columns
  * @return Collection
  */
 public static function all()
 {
     $instance = new static();
     return $instance->query()->all();
 }
開發者ID:buditanrim,項目名稱:kirby-comments,代碼行數:11,代碼來源:model.php

示例11: find_by_sql

 public static function find_by_sql($sql = "")
 {
     $instance = new static();
     //$object_array =[];
     $object_array = array();
     $sql = $instance->query($sql);
     if ($sql->execute()) {
         while ($row = $sql->fetchAll(\PDO::FETCH_KEY_PAIR)) {
             $object_array[] = $row;
         }
         if ($object_array) {
             return $object_array;
         } else {
             return false;
         }
     }
 }
開發者ID:runningjack,項目名稱:busticketNew,代碼行數:17,代碼來源:DB.php

示例12: reset

 /**
  * Reset the class variables to null.
  */
 public static function reset()
 {
     static::$query = null;
     static::$post = null;
     static::$properties = null;
     static::$server = null;
     static::$cookies = null;
     static::$files = null;
     static::$headers = null;
     static::$method = null;
     static::$pathInfo = null;
     static::$requestUri = null;
     static::$requestPath = null;
     static::$basePath = null;
     static::$baseUrl = null;
 }
開發者ID:avalonphp,項目名稱:avalon,代碼行數:19,代碼來源:Request.php

示例13: find

 /**
  * Find a model by its primary key.
  *
  * @param  string  $id
  * @param  array   $columns
  * @return Model
  */
 public static function find($id, $columns = array('*'))
 {
     $model = new static();
     $query = $model->query()->where(static::$key, '=', $id);
     list($query, $columns) = $model->before_find($query, $columns);
     $result = $query->take(1)->first($columns);
     $result = $model->after_find($result);
     if (count($result) > 0) {
         return $model->is_new(false)->fill($result);
     }
     return null;
 }
開發者ID:reith2004,項目名稱:components,代碼行數:19,代碼來源:crud.php

示例14: start

 /**
  * Старт маршрутизации
  */
 public static function start()
 {
     if (static::$start) {
         return false;
     } else {
         static::$start = true;
     }
     static::$record = true;
     static::$host = Request::host();
     static::$path = Request::path();
     static::$query = Request::query();
     static::$method = Request::method();
     if (preg_match('#^/index.php#i', static::$path)) {
         Error::e404();
     }
     if (preg_match('#^/public/#i', static::$path)) {
         Error::e404();
     }
     static::running();
     if (!static::$found) {
         if (mb_substr(static::$path, -1, 1) != '/') {
             $extension = pathinfo(static::$path, PATHINFO_EXTENSION);
             if ($extension == "") {
                 static::$path .= "/";
                 static::running();
                 if (static::$found) {
                     Redirect::r302(static::$path . (static::$query != '' ? '?' . static::$query : ''));
                 }
             }
         }
     }
     static::$record = false;
     if (static::$found) {
         static::render();
     } else {
         Error::e404();
     }
 }
開發者ID:AlexanderGrom,項目名稱:knee,代碼行數:41,代碼來源:route.php

示例15: update

 /**
  * Update a model instance in the database.
  *
  * @param  mixed  $id
  * @param  array  $attributes
  * @return int
  */
 public static function update($id, $attributes)
 {
     $model = new static(array(), true);
     $model->fill($attributes);
     if (static::$timestamps) {
         $model->timestamp();
     }
     return $model->query()->where($model->key(), '=', $id)->update($model->attributes);
 }
開發者ID:ragi79,項目名稱:laravel,代碼行數:16,代碼來源:model.php


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