/*
    **  @author water
    **  @admin 跨域问题 
    **  @2018-10-10
    **  
    */

    public function _initialize(){
        $this->cross();
}

    public function cross(){
        header('Content-Type:application/json; charset=utf-8');
        header('Access-Control-Allow-Origin:前端域名地址'); 
        //header('Access-Control-Max-Age:86400'); 
        header('Access-Control-Allow-Methods:OPTIONS,POST,PUT,DELETE');
}

只有我是water
2 声望0 粉丝