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


PHP Movie::insert方法代码示例

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


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

示例1: insert_video_type

 /**
  * Insert video for derived type.
  * @param array $data
  * @param array $gtypes
  * @param array $options
  * @return int
  */
 private static function insert_video_type(array $data, $gtypes, $options = array())
 {
     if (count($gtypes) > 0) {
         $gtype = $gtypes[0];
         switch ($gtype) {
             case 'tvshow':
                 return TVShow_Episode::insert($data, $gtypes, $options);
             case 'movie':
                 return Movie::insert($data, $gtypes, $options);
             case 'clip':
                 return Clip::insert($data, $gtypes, $options);
             case 'personal_video':
                 return Personal_Video::insert($data, $gtypes, $options);
             default:
                 // Do nothing, video entry already created and no additional data for now
                 break;
         }
     }
     return $data['id'];
 }
开发者ID:ivan801,项目名称:ampache,代码行数:27,代码来源:video.class.php

示例2: parseMovie

 public function parseMovie($movie_array)
 {
     $movie = new Movie();
     $movie->setMovie($movie_array);
     if ($movie->exists()) {
         if ($movie->requiresUpdate()) {
             $movie->update();
         } else {
             echo "OK - ID: " . $movie->id . "; Modified: " . $movie->modified . "<br>";
         }
     } else {
         $movie->insert();
     }
     if ($movie_array->venues->children()) {
         Movie::parseMovieVenues($movie_array['movieId'], $movie_array->venues);
     }
 }
开发者ID:ievgen11,项目名称:going_test_1,代码行数:17,代码来源:index.php

示例3: curl_init

<?php

include __DIR__ . '/init.inc.php';
$top_url = 'http://itunes.apple.com/tw/genre/dian-ying/id33?l=zh';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $top_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, 0);
$message = curl_exec($curl);
curl_close($curl);
if (!preg_match_all('#<a href="([^"]*)" class="top-level-genre" title="[^"]*">[^<]*</a>#', $message, $matches)) {
    die('failed');
}
foreach ($matches[1] as $genre_url) {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $genre_url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    $message = curl_exec($curl);
    curl_close($curl);
    preg_match_all('#<li><a href="(http://itunes.apple.com/tw/movie/[^/]*/id([0-9]+)\\?l=zh)">([^<]*)</a> </li>#', $message, $matches);
    foreach ($matches[0] as $id => $data) {
        $url = $matches[1][$id];
        $movie_id = $matches[2][$id];
        $movie_name = $matches[3][$id];
        if (Movie::find($movie_id)) {
            continue;
        }
        Movie::insert(array('id' => $movie_id, 'url' => $url, 'description' => $movie_name, 'created_at' => time()));
    }
}
开发者ID:ronnywang,项目名称:itunes-taiwan-update,代码行数:31,代码来源:crawler.php


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