首页图标太大了,改版后都不想进来了
的确是这样的,我试了一下可以的。
会不会和windows有关?貌似站长没有这个问题
我也遇到了这个问题,使用了TP5的测试了一下就没有问题。
我在问答中描述了一下问题,感觉可能是设置的问题
这个问题困扰了我一下午,我测试了TP5和Laravel5.4还有原生直接书写。
我在TP5和原生PHP中直接在方法中书写
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
header("Access-Control-Allow-Headers:DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
$data = ['id' => '222','title' => '222','completed' => 'false'];
echo json_encode($data);
我在Laravel5.4中使用的cors扩展书写
Route::post('/msg/create', function (Request $request) {
$data = ['id' => '222','title' => '222','completed' => 'false'];
return $data;
})->middleware('cors:api');
我再vue中是这样访问的
axios.post('http://api_tp.com/index.php/index/index/tp_msg',{}).then(response => {
console.log(response.data);
return false;
});
结果我可以用TP5和原生php的方法访问到数据,laravel中的话会直接卡在OPTIONS请求,提示了跨域的错误。
'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
使用了,我发现patch和delete都有报错
试验了好几次,我再进行get请求的时候没有什么问题,可是post请求的时候就会发生跨域的提示,不知道这个是怎么回事啊?我看了下请求method是OPTIONS的。
catch error提示 vue Error: Network Error
似乎少了一个 vue-template-compiler ,我这里会报错的