Skip to content

Instantly share code, notes, and snippets.

@fabiopaiva
Created September 19, 2014 12:58
Show Gist options
  • Save fabiopaiva/ab0369a81b95ccee1eb8 to your computer and use it in GitHub Desktop.
Save fabiopaiva/ab0369a81b95ccee1eb8 to your computer and use it in GitHub Desktop.
ZF2 global configuration
<?php
return array(
'example' => array(
'foo' => 'bar'
)
);
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
class ExampleController extends AbstractActionController{
public function indexAction() {
$config = $this->getServiceLocator()->get('Config');
$example = $config['example'];
$foo = $example['foo'];
return array(
'foo' => $foo
);
}
}
Foo: <?php echo $foo;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment