本文整理匯總了PHP中Artist::saveArtist方法的典型用法代碼示例。如果您正苦於以下問題:PHP Artist::saveArtist方法的具體用法?PHP Artist::saveArtist怎麽用?PHP Artist::saveArtist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Artist
的用法示例。
在下文中一共展示了Artist::saveArtist方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
$_SESSION['list_of_cds'] = array();
}
if (empty($_SESSION['list_of_artists'])) {
$_SESSION['list_of_artists'] = array();
}
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
// routes
$app->get("/", function () use($app) {
return $app['twig']->render('cds.html.twig', array('cds' => Cd::getAll()));
});
$app->post("/cds", function () use($app) {
$new_artist = new Artist($_POST['artist']);
$new_cd = new Cd($new_artist, $_POST['title'], $_POST['cover']);
$new_cd->saveCd();
$new_artist->saveArtist();
return $app['twig']->render('cds.html.twig', array('cds' => Cd::getAll()));
});
$app->get("/search", function () use($app) {
return $app['twig']->render('search.html.twig');
});
$app->post("/search", function () use($app) {
$cds = Cd::getAll();
$artist_matching_search = array();
foreach ($cds as $cd) {
if ($cd->search($_POST['user_input'])) {
array_push($artist_matching_search, $cd);
}
}
return $app['twig']->render('search.html.twig', array('matching' => $artist_matching_search));
});