Skip to content

Instantly share code, notes, and snippets.

@ogabrielsantos
Created January 25, 2016 14:02
Show Gist options
  • Save ogabrielsantos/4d4d22a8028d95c6415b to your computer and use it in GitHub Desktop.
Save ogabrielsantos/4d4d22a8028d95c6415b to your computer and use it in GitHub Desktop.
AdController.php
<?php
/**
* Class AdController
*/
class AdController extends Controller
{
/**
* @var array
*/
private $ads = [
'catho_ambev_cv_id_8233' => 'http://ad.zanox.com/ppc/?36673797C387592410T',
'catho_ambev_cv_id_2' => 'http://ad.zanox.com/ppc/?36673797C387592410T'
];
/**
* Redireciona para o anúncio
*/
final public function actionView($id)
{
if (!array_key_exists($id, $this->ads)) {
$this->redirect('http://www.spinver.com');
}
$this->redirect($this->ads[$id]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment