如何修复Unity WebRequest未知错误

时间:2019-04-11 14:15:49

标签: php unity3d

当我统一请求laravel api时,下面的代码有问题。

我将此标头添加到conf中的〜.php $位置

add_header 'Access-Control-Allow-Origin' "*";
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT,OPTION';
add_header 'Access-Control-Allow-Credentials' "true";
add_header 'Access-Control-Allow-Headers' "x-authorization, Content-Type, Accept, X-Access-Token, X-Application-Name, X-Request-Sent-Time";

我还在过滤器php app :: After函数中设置了响应头。 php laravel

    $response->headers->set('Access-Control-Allow-Headers','x-authorization, Content-Type');
    $response->headers->set('Access-Control-Allow-Methods','GET, POST, PUT, OPTIONS');
    $response->headers->set('Access-Control-Allow-Origin','*');

c#

    WWWForm form = new WWWForm();
    form.AddField("email", email_id);
    form.AddField("password", password);
    www2.certificateHandler = new 
    AcceptAllCertificatesSignedWithASpecificKeyPublicKey();
    www2.chunkedTransfer = true;
    yield return www2.SendWebRequest();
    Debug.Log("downloadHandler Text : " + www2.downloadHandler.text);
    Debug.Log("responseCode : " + www2.responseCode);
    Debug.Log("isDone : " + www2.isDone);
    Debug.Log("method : " + www2.method);

调试是 downloadHandler文本: responseCode:0 isDone:正确 方法:开机自检 错误:未知错误

我认为ubuntu服务器中需要更改设置。据我了解,统一要知道服务器证书是ssl问题。能否请你帮忙?非常感谢。

0 个答案:

没有答案