예제 #1
0
 /**
  * 关闭缓存链接
  */
 public function close()
 {
     if (is_object($this->memcache)) {
         $this->memcache->close();
     }
 }
예제 #2
0
 public function shutdown()
 {
     $this->channel->close();
     $this->amqp->close();
 }
예제 #3
0
/**
 * 食物做法步骤
 * @param unknown $db
 * @param unknown $foodid
 * @param unknown $content
 */
function setContent(&$db, $recid, $content, $imagefile)
{
    if ($content == null) {
        return;
    }
    //$method=explode("||", $content);
    $method = json_decode($content, true);
    for ($i = 1; $i <= sizeof($method); $i++) {
        if (empty($imagefile[$i - 1])) {
            $imagefile[$i - 1] = 'http://' . getServerIp() . '/uploads/recommendedfood/default.jpg';
        }
        $sql = "insert into foodmethod values({$recid},{$i},'" . stringToDb($method[$i - 1]) . "','{$imagefile[$i - 1]}');";
        $res = $db->execute($sql);
        if (!$res) {
            echo getJsonResponse(1, $db->error, null);
            Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
            $db->rollback();
            $db->close();
            exit;
        }
    }
}