本文整理汇总了PHP中Movie::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::setTitle方法的具体用法?PHP Movie::setTitle怎么用?PHP Movie::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::setTitle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFromCsv
public function loadFromCsv($file)
{
while ($movieText = fgetcsv($file)) {
//print_r($movie);
//var_dump($streamName);
$streamName = trim($movieText[1]);
if (!isset($this->dates[$movieText[0]])) {
$this->dates[$movieText[0]] = 1;
// echo $this->dates[$movieText[0]];
} else {
$this->dates[$movieText[0]]++;
}
$flixUrl = "http://www.omdbapi.com/?r=json&t=" . urlencode($streamName);
//var_dump($flixUrl);
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $flixUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
$flixData = json_decode($data, true);
$movie = new Movie();
if (isset($flixData['Title'])) {
$movie->setTitle($flixData['Title']);
} else {
$movie->setTitle($streamName);
}
if (isset($flixData['Runtime'])) {
$movie->setDuration($flixData['Runtime']);
} else {
$movie->setDuration(null);
}
if (isset($flixData['imdbRating'])) {
$movie->setimdbRating($flixData['imdbRating']);
} else {
$movie->setimdbRating(null);
}
if (isset($flixData['imdbRating'])) {
$movie->setimdbRating($flixData['imdbRating']);
} else {
$movie->setimdbRating(null);
}
if (isset($flixData['Genre'])) {
$movie->setGeneres(explode(", ", $flixData['Genre']));
} else {
$movie->setGeneres(array());
}
if (!$this->movieExists($movie)) {
array_push($this->movies, $movie);
}
//}
//print_r($this->movies);
}
}
示例2: buildDomainObject
protected function buildDomainObject($row)
{
$movie = new Movie();
$movie->setId($row['mov_id']);
$movie->setTitle($row['mov_title']);
$movie->setDescriptionS($row['mov_description_short']);
return $movie;
}
示例3: buildDomainObject
protected function buildDomainObject($row)
{
$movie = new Movie();
$movie->setId($row['mov_id']);
$movie->setTitle($row['mov_title']);
$movie->setDecriptionShort($row['mov_description_short']);
$movie->setDecriptionLong($row['mov_description_long']);
$movie->setDirector($row['mov_director']);
$movie->setYear($row['mov_year']);
$movie->setImage($row['mov_image']);
if (array_key_exists('id_categorie', $row)) {
$categoryID = $row['cat_id'];
$category = $this->categoryDAO->find($categoryId);
$movie->setCategory($category);
}
return $movie;
}
示例4: db_add_movie
public function db_add_movie()
{
if (isset($_POST['submit'])) {
try {
$db = new Database();
$movie = new Movie($db);
$movie->setTitle(htmlspecialchars($_POST['movie-title']));
$movie->setDirector(htmlspecialchars($_POST['movie-director']));
$movie->setSynopsis(htmlspecialchars($_POST['movie-synopsis']));
$movie->setYear(htmlspecialchars($_POST['movie-year']));
$movie->setCountry(htmlspecialchars($_POST['movie-country']));
$movie->setDuration(htmlspecialchars($_POST['movie-duration']));
$movie->add_movie();
} catch (Exception $e) {
echo "Error: {$e->getMessage()}";
}
}
}
示例5: Movie
$movie = new Movie($db);
$selected = substr($_POST['update_title'], 1, -1);
$movie->setId($selected);
$rows = $movie->find_movie_by_id();
if (is_array($rows)) {
try {
$view = new View();
$view->view_selected_movie($rows);
} catch (Exception $e) {
echo "Error: {$e->getMessage()}";
}
} else {
throw new Exception("Error: Please contact the tech guys.");
}
$db = NULL;
}
if (isset($_POST['update_movie'])) {
$db = new Database();
$movie = new Movie($db);
$selected = $_POST['movie_id'];
$movie->setId($selected);
$movie->setTitle($_POST['movie-title']);
$movie->setDirector($_POST['movie-director']);
$movie->setSynopsis($_POST['movie-synopsis']);
$movie->setYear($_POST['movie-year']);
$movie->setCountry($_POST['movie-country']);
$movie->setDuration($_POST['movie-duration']);
if ($movie->update_movie()) {
echo "It works!";
}
}
示例6: Game
include 'database_connection.php';
include 'classes/MediaItem.php';
include 'classes/Game.php';
include 'classes/Book.php';
include 'classes/Music.php';
include 'classes/Movie.php';
$game = new Game();
$game->setTitle('Watch Dogs');
$game->setDesc('Crappy shit wannabe hacker game');
$game->setRating(1);
$game->setTags(['dnt']);
print '<p>' . ($game->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$book = new Book();
$book->setTitle('Momo');
$book->setDesc('Dreamy and so on');
$book->setRating(4);
$book->setTags(['tc']);
print '<p>' . ($book->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$movie = new Movie();
$movie->setTitle('The big short');
$movie->setDesc('Capitalism');
$movie->setRating(3);
$movie->setTags(['tc', 'wtf']);
print '<p>' . ($movie->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$music = new Music();
$music->setTitle('Bravo Hits 666');
$music->setDesc('Diabolic Bullshit');
$music->setRating(1);
$music->setTags(['dnt']);
print '<p>' . ($music->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
示例7: testI18nWithRelations
public function testI18nWithRelations()
{
MovieQuery::create()->deleteAll();
$count = MovieQuery::create()->count();
$this->assertEquals(0, $count, 'No movie before the test');
ToyQuery::create()->deleteAll();
$count = ToyQuery::create()->count();
$this->assertEquals(0, $count, 'No toy before the test');
MovieI18nQuery::create()->deleteAll();
$count = MovieI18nQuery::create()->count();
$this->assertEquals(0, $count, 'No i18n movies before the test');
$m = new Movie();
$m->setLocale('en');
$m->setTitle('V For Vendetta');
$m->setLocale('fr');
$m->setTitle('V Pour Vendetta');
$m->setLocale('en');
$this->assertEquals('V For Vendetta', $m->getTitle());
$m->setLocale('fr');
$this->assertEquals('V Pour Vendetta', $m->getTitle());
$t = new Toy();
$t->setMovie($m);
$t->save();
$count = MovieQuery::create()->count();
$this->assertEquals(1, $count, '1 movie');
$count = ToyQuery::create()->count();
$this->assertEquals(1, $count, '1 toy');
$count = MovieI18nQuery::create()->count();
$this->assertEquals(2, $count, '2 i18n movies');
$count = ToyI18nQuery::create()->count();
$this->assertEquals(0, $count, '0 i18n toys');
}
示例8: match
}
// match html from imdb
foreach (match_all('/<tr class="(even|odd)">(.*?)<\\/tr>/ms', $html, 2) as $m) {
$rank++;
$id = match('/<td class="titleColumn">.*?<a href="\\/title\\/(tt\\d+)\\/.*?"/msi', $m, 1);
$title = match('/<td class="titleColumn">.*?<a.*?>(.*?)<\\/a>/msi', $m, 1);
$year = match('/<td class="titleColumn">.*?<span.*?>\\((.*?)\\)<\\/span>/msi', $m, 1);
$rating = match('/<td class="ratingColumn">.*?<strong.*?>(.*?)<\\/strong>/msi', $m, 1);
$poster = match('/<td class="posterColumn">.*?<img src="(.*?)"/msi', $m, 1);
$votesURL = "http://www.imdb.com/title/" . $id . "/";
$votes = getvotes($votesURL);
// create each movie object and set the variables
$movie = new Movie();
$movie->setId($id);
$movie->setRank($rank);
$movie->setTitle($title);
$movie->setYear($year);
$movie->setRating($rating);
$movie->setVotes($votes);
// insert $movie objects into an array
array_push($top10Movies, $movie);
// stop at 10
if ($rank == 10) {
break;
}
}
$date = $db->select("movies", "date_added");
// insert into database using medoo if it does not exist
foreach ($top10Movies as $movie) {
// check database for matching date, if same day update, else insert
if (in_array($today, $date)) {