前端请求thinkPHP接口报错。
报错信息如下所示:
解决: 在ThinkPHP\Library\Think\Controller.class.php中加入
header('Access-Control-Allow-Origin: http://localhost:8080'); // 前端访问地址
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
header('Access-Control-Allow-Methods: GET, POST, PUT');
header('Access-Control-Allow-Credentials: true');