CakesController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace TestApp\Controller;
  3. use Cake\Controller\Controller;
  4. use Cake\Network\Exception\NotFoundException;
  5. /**
  6. * CakesController class
  7. */
  8. class CakesController extends Controller
  9. {
  10. /**
  11. * The default model to use.
  12. *
  13. * @var string
  14. */
  15. public $modelClass = 'Posts';
  16. /**
  17. * index method
  18. *
  19. * @return \Cake\Network\Response
  20. */
  21. public function index()
  22. {
  23. $this->response->body('Hello Jane');
  24. return $this->response;
  25. }
  26. /**
  27. * No autoRender
  28. *
  29. * @return void
  30. */
  31. public function noRender()
  32. {
  33. $this->autoRender = false;
  34. $this->response->body('autoRender false body');
  35. }
  36. /**
  37. * invalid method
  38. *
  39. * @return \Cake\Network\Response
  40. */
  41. public function invalid()
  42. {
  43. return 'Some string';
  44. }
  45. /**
  46. * startup process.
  47. */
  48. public function startupProcess()
  49. {
  50. parent::startupProcess();
  51. if ($this->request->param('stop') === 'startup') {
  52. $this->response->body('startup stop');
  53. return $this->response;
  54. }
  55. }
  56. /**
  57. * shutdown process.
  58. */
  59. public function shutdownProcess()
  60. {
  61. parent::shutdownProcess();
  62. if ($this->request->param('stop') === 'shutdown') {
  63. $this->response->body('shutdown stop');
  64. return $this->response;
  65. }
  66. }
  67. }