Index.php 885 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\HttpController;
  3. use EasySwoole\Http\AbstractInterface\Controller;
  4. class Index extends Controller
  5. {
  6. public function index()
  7. {
  8. $file = EASYSWOOLE_ROOT.'/vendor/easyswoole/easyswoole/src/Resource/Http/welcome.html';
  9. if(!is_file($file)){
  10. $file = EASYSWOOLE_ROOT.'/src/Resource/Http/welcome.html';
  11. }
  12. $this->response()->write(file_get_contents($file));
  13. }
  14. function test()
  15. {
  16. $this->response()->write('this is test');
  17. }
  18. protected function actionNotFound(?string $action)
  19. {
  20. $this->response()->withStatus(404);
  21. $file = EASYSWOOLE_ROOT.'/vendor/easyswoole/easyswoole/src/Resource/Http/404.html';
  22. if(!is_file($file)){
  23. $file = EASYSWOOLE_ROOT.'/src/Resource/Http/404.html';
  24. }
  25. $this->response()->write(file_get_contents($file));
  26. }
  27. }