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


PHP Data::query方法代码示例

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


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

示例1: save

 public static function save($id)
 {
     $res = Data::query('movie', 'id_ac = ' . $id);
     if (!count($res)) {
         $info = static::getInfosMovie($id);
         $info['id_ac'] = $id;
         $info['id_video'] = null;
         $info['plateforme'] = null;
         $movie = Data::getById('movie', Data::add('movie', $info));
     } else {
         $movie = Data::getObject(current($res));
     }
     return $movie;
 }
开发者ID:schpill,项目名称:thin,代码行数:14,代码来源:Allocine.php

示例2: auto

 public static function auto($sentence, $source = 'fr', $target = 'en')
 {
     $key = sha1(serialize(func_get_args()));
     $res = Data::query('translation', 'key = ' . $key);
     if (count($res)) {
         $obj = current($res);
         return $obj->getSentence();
     }
     $source = Inflector::lower($source);
     $target = Inflector::lower($target);
     $url = "http://api.mymemory.translated.net/get?q=" . urlencode($sentence) . "&langpair=" . urlencode($source) . "|" . urlencode($target);
     $res = dwn($url);
     $tab = json_decode($res, true);
     if (Arrays::exists('responseData', $tab)) {
         if (Arrays::exists('translatedText', $tab['responseData'])) {
             $translation = $tab['responseData']['translatedText'];
             $data = array('source' => $source, 'target' => $target, 'key' => $key, 'sentence' => $translation);
             Data::add('translation', $data);
             return $translation;
         }
     }
     return $sentence;
 }
开发者ID:schpill,项目名称:thin,代码行数:23,代码来源:Translation.php

示例3: query

 public function query($condition)
 {
     $this->firstQuery = false;
     Data::_incQueries(Data::_getTime());
     $queryKey = sha1(serialize($condition) . 'QueryData');
     $cache = Data::cache($this->type, $queryKey);
     if (!empty($cache) && true === $this->cache) {
         return $cache;
     }
     $this->wheres[] = $condition;
     if (is_string($condition)) {
         $res = Data::query($this->type, $condition);
         $collection = array();
         if (count($res)) {
             foreach ($res as $row) {
                 if (is_string($row)) {
                     $tab = explode(DS, $row);
                     $id = repl(".data", '', Arrays::last($tab));
                 } else {
                     if (is_object($row)) {
                         $id = $row->id;
                     }
                 }
                 $collection[] = $id;
             }
         }
     } else {
         if (Arrays::isArray($condition)) {
             $collection = $condition;
         } else {
             $collection = array();
         }
     }
     $cache = Data::cache($this->type, $queryKey, $collection);
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:36,代码来源:Querydata.php

示例4: checkTimeout

 public function checkTimeout()
 {
     $sessions = parent::query('thinsession', 'expire < ' . time());
     if (count($sessions)) {
         foreach ($sessions as $session) {
             $session = parent::getObject($session);
             $delete = parent::delete('thinsession', $session->getId());
         }
     }
 }
开发者ID:schpill,项目名称:thin,代码行数:10,代码来源:Sessionbis.php

示例5: forget

 /**
  * Delete an item from the cache.
  *
  * @param  string  $key
  * @return void
  */
 public function forget($key)
 {
     $this->_cleanCache();
     $res = Data::query('cache', 'key = ' . $key . ' && namespace = ' . $this->namespace);
     if (count($res)) {
         $obj = Data::getObject(current($res));
         $del = Data::delete('cache', $obj->getId());
     }
 }
开发者ID:schpill,项目名称:thin,代码行数:15,代码来源:Cachedata.php

示例6: die

$conn = Data::connect();
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
$gedaan = isset($_POST['factuurid']) ? $_POST['factuurid'] : 0;
echo $gedaan;
$gedaan = $gedaan + 1;
echo $gedaan;
$counter = $gedaan;
if (Data::bestaatNaam(Data::getPost("naam"))) {
    $naam = Data::getPost('naam');
    $adres = Data::getPost('adres');
    $query = "'{$naam}', '{$adres}'";
    $table = "klant (naam, adres)";
    echo Data::query($table, $conn, $query);
    $gedaan = 1;
    $klantid = Data::laasteID($conn);
} else {
    $klantid = 0;
}
?>


    <body>
        <div id="container">
            <aside>
                <nav>
                    <ul>
                        <li><a href="index.html">Home</a></li>
                        <li><a href="formulier.php">Factuur</a></li>
开发者ID:Brakke,项目名称:S-S,代码行数:31,代码来源:formulier.php


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