Phpstudy访问www中的子文件夹

要访问子文件夹首先端口要设置正确,然后设置如下:

Phpstudy访问www中的子文件夹_第1张图片

在Unity中使用UnityWebRequest测试,测试代码如下:

using System.Collections;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;

public class FileDownloader : MonoBehaviour
{

    void Start()
    {
        StartCoroutine(DownloadFile());
    }

    IEnumerator DownloadFile()
    {
        var uwr = new UnityWebRequest("http://localhost:8080/300dzz5g.jumpw.com/wxdev/", UnityWebRequest.kHttpVerbGET);
        string path = Path.Combine(Application.dataPath, "/md5.txt");
        uwr.downloadHandler = new DownloadHandlerFile(path);
        yield return uwr.SendWebRequest();
        if (uwr.result != UnityWebRequest.Result.Success)
            Debug.LogError(uwr.error);
        else
            Debug.Log("File successfully downloaded and saved to " + path);

    }
}

成功! perfect! 

你可能感兴趣的:(知识点记录,unity)