/**

  • 允许跨域请求
  • @author ushe 0.1
  • @param string $domain
  • @param null $methods
  • @param null $headers / public function allowOrigin($domain = '', $methods = null, $headers = null) { if(is_null($methods)) { $methods = 'GET, POST, PUT, DELETE, PATCH'; } if(is_null($headers)) { $headers = 'Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With'; } header("Access-Control-Allow-Origin:{$domain}"); header("Access-Control-Allow-Methods:{$methods}"); header("Access-Control-Allow-Headers:{$headers}"); }