控制台应用,yzncms本身基于tp5.1框架,里面的队列用不了,bug,坑
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CORS.php 641B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace app\api\behavior;
  3. use think\facade\Session;
  4. use think\Request;
  5. /**
  6. * CORS跨域
  7. * Class CORS
  8. * @package app\api\behavior
  9. */
  10. class CORS
  11. {
  12. public function run()
  13. {// 响应头设置 我们就是通过设置header来跨域的 这就主要代码了 定义行为只是为了前台每次请求都能走这段代码
  14. header('Access-Control-Allow-Origin:*');
  15. header('Access-Control-Allow-Methods:*');
  16. header('Access-Control-Allow-Headers:*');
  17. header('Access-Control-Allow-Credentials:false');
  18. if (request()->isOptions()) {
  19. sendResponse('',200,'ok');
  20. }
  21. }
  22. }