Guest User

Untitled

a guest
May 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. // 雰囲気こんな感じ。
  3. // 実際はファイル分けたりしてる
  4.  
  5. class HogeController
  6. {
  7. public function index($b) {
  8. return $b->provide('fuga');
  9. // return $this->phpt('index');
  10. }
  11. }
  12.  
  13. use blanka\Router,
  14. blanka\response\Ok,
  15. blanka\container\ContainerBuilder,
  16. blanka\plugin\PHPTemplate;
  17.  
  18. $cb = new ContainerBuilder;
  19. $cb->bind('fuga')->toValue('xxx');
  20. $cb->bind('controller')->to('HogeController');
  21.  
  22. Blanka::app($cb->build())
  23. ->load(new PHPTemplate(__DIR__. '/templates', 'html'))
  24. ->respond(Router::it()
  25. ->{'/ :index'}('@controller::index')
  26. ->{'/test :test'}(function($b) {
  27. return $b->provide('fuga');
  28. })
  29. );
Add Comment
Please, Sign In to add comment