当前位置: 首页>>代码示例>>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;未经允许,请勿转载。