| xqd
@@ -28,6 +28,27 @@ use mysql_xdevapi\Exception;
|
|
|
|
|
|
class ApiController extends Controller
|
|
|
{
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+
|
|
|
+ // 允许 $originarr 数组内的 域名跨域访问
|
|
|
+
|
|
|
+ header('Access-Control-Allow-Origin:*');
|
|
|
+
|
|
|
+ // 响应类型
|
|
|
+
|
|
|
+ header('Access-Control-Allow-Methods:POST,GET');
|
|
|
+
|
|
|
+ // 带 cookie 的跨域访问
|
|
|
+
|
|
|
+ header('Access-Control-Allow-Credentials: true');
|
|
|
+
|
|
|
+ // 响应头设置
|
|
|
+
|
|
|
+ header('Access-Control-Allow-Headers:x-requested-with,Content-Type,X-CSRF-Token');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//获取订单
|
|
|
public function getDocter()
|
|
|
{
|