url转路径地址

网络爬虫url链接相对转绝对路径 通过本文的介绍,读者了解了如何使用Python内置的模块处理URL路径转换。通过几行代码,就可以轻松地将相对路径转换为绝对路径,避免网页抓取时遇到的404错误。此外,模块还提供了许多有用的URL解析和重构功能,可以帮助开发者在处理复杂URL时更加高效。掌握这些方法后,读者可以更好地进行网页数据采集,提升抓取的准确性和效率。 阅读详情

/**
* android7.0以上处理方法
*/

    private static String getFilePathForN(Context context, Uri uri) {
        try {
            Cursor returnCursor = context.getContentResolver().query(uri, null, null, null, null);
            int nameIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
            returnCursor.moveToFirst();
            String name = (returnCursor.getString(nameIndex));
            File file = new File(context.getFilesDir(), name);
            InputStream inputStream = context.getContentResolver().openInputStream(uri);
            FileOutputStream outputStream = new FileOutputStream(file);
            int read = 0;
            int maxBufferSize = 1 * 1024 * 1024;
            int bytesAvailable = inputStream.available();

            int bufferSize = Math.min(bytesAvailable, maxBufferSize);

            final byte[] buffers = new byte[bufferSize];
            while ((read = inputStream.read(buffers)) != -1) {
                outputStream.write(buffers, 0, read);
            }
            returnCursor.close();
            inputStream.close();
            outputStream.close();
            return file.getPath();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

/**

  • android7.0之前处理方法
    */
 @TargetApi(Build.VERSION_CODES.KITKAT)
    public static String getPath(final Context context, final Uri uri) throws Exception {
        final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            return getFilePathForN(context, uri);
        }else {
            if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
                if (isExternalStorageDocument(uri)) {
                    final String docId = DocumentsContract.getDocumentId(uri);
                    final String[] split = docId.split(":");
                    final String type = split[0];
                    if ("primary".equalsIgnoreCase(type)) {
                        return Environment.getExternalStorageDirectory() + "/" + split[1];
                    }
                }
                else if (isDownloadsDocument(uri)) {

                    String id = DocumentsContract.getDocumentId(uri);
                    Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));

                    return getDataColumn(context, contentUri, null, null);
                }
                else if (isMediaDocument(uri)) {
                    final String docId = DocumentsContract.getDocumentId(uri);
                    final String[] split = docId.split(":");
                    final String type = split[0];

                    Uri contentUri = null;
                    if ("image".equals(type)) {
                        contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
                    } else if ("video".equals(type)) {
                        contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
                    } else if ("audio".equals(type)) {
                        contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
                    }

                    final String selection = "_id=?";
                    final String[] selectionArgs = new String[] {
                            split[1]
                    };

                    return getDataColumn(context, contentUri, selection, selectionArgs);
                }
            }
            else if ("content".equalsIgnoreCase(uri.getScheme())) {
                return getDataColumn(context, uri, null, null);
            }
            else if ("file".equalsIgnoreCase(uri.getScheme())) {
                return uri.getPath();
            }

            return null;
        }

    }

    /**
     * 获取此Uri的数据列的值。这对于MediaStore uri和其他基于文件的内容提供程序非常有用。
     */
    public static String getDataColumn(Context context, Uri uri, String selection,
                                       String[] selectionArgs) {
        Cursor cursor = null;
        final String column = "_data";
        final String[] projection = {column};
        try {
            cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                    null);
            if (cursor != null && cursor.moveToFirst()) {
                final int column_index = cursor.getColumnIndexOrThrow(column);
                return cursor.getString(column_index);
            }
        } catch (IllegalArgumentException e){
        } finally {
            if (cursor != null)
                cursor.close();
        }
        return null;
    }

    public static boolean isExternalStorageDocument(Uri uri) {
        return "com.android.externalstorage.documents".equals(uri.getAuthority());
    }

    public static boolean isDownloadsDocument(Uri uri) {
        return "com.android.providers.downloads.documents".equals(uri.getAuthority());
    }

    public static boolean isMediaDocument(Uri uri) {
        return "com.android.providers.media.documents".equals(uri.getAuthority());
    }
url地址转换 可将url地址进行转换编码,缩短地址使用。挺方便的。 立即下载

相关推荐

墨水屏开发避坑指南:SSD1683局刷 vs 全刷的取舍与波形文件优化技巧

本文深入解析了SSD1683墨水屏驱动芯片开发中的核心问题,重点对比了全屏刷新与局部刷新的原理、代码实现差异及适用场景。文章提供了波形文件(LUT)的结构解读与优化技巧,并详细阐述了VGH、VSH、VCOM等关键驱动电压参数的调试方法,旨在帮助开发者在电子价签、阅读器等项目中根据功耗、速度与显示质量需求做出最佳取舍。

weixin_29207533的博客 723

将网页中的相对路径转化为绝对路径

#region 计算路径         ///         /// 根据网页地址获取域名         ///         /// 网页地址         /// 返回域名         private static string GetDomain(string oldUrl)         {             string result =

MeGoodtoo的专栏 2779

MaxENT生态位模型实战:从数据准备到论文发表的完整指南

本文提供MaxENT生态位模型从数据准备到论文发表的完整实战指南,涵盖物种分布数据处理、环境变量筛选、参数优化及结果可视化等关键步骤。特别介绍如何通过R语言进行高级建模优化,提升模型AUC值,并分享海洋生物专题研究中的数据处理技巧。适合生态学研究者快速掌握这一强大的物种分布预测工具,产出高质量研究成果。

tensor9flow的博客 311

PHP将相对路径URL转换为绝对路径URL

在采集程序或者蜘蛛程序中经常会遇到一类问题,就是将网页中相对路径形式的URL转换为绝对路径形式的URL。例如在http://www.msphome.cn/blog/1/这个页面中,有一个URL链接为../index.php,那么我们要将它转换为http://www.msphome.cn/blog/index.php。下面给出了解决这类问题的代码。该程序能够成功处理各种URL,将其变成绝对形式。

weixin_71792169的博客 759

HA集群 执行 hdfs haadmin -transitionToActive 失败

最近把一个单NameNode集群变更为HA集群,过程中都很顺利,nn1和nn2两个NameNode都显示standby状态,但是把nn1或者nn2切换到active状态时就会报错抛异常。 查看master上namenode启动日志,如下: Incompatible clusterID for journal Storage Directory /home/hadoop-zero/bigdat...

qq_34727158的博客 1773

【25年荣耀校招-()-4月18日-第二题(200分)- 测量接收信号】(题目+思路+Java&C++&Python解析+在线测试)

有一个接收机,以1ms为周期,测量接收信号强度。假设每个测量时刻所测量到的接收信号的强度是独立且同分布的。已知每个测量时刻的接收信号的强度的大于−100dBm的概率为Plarge。请求解以下事件的概率,并将概率输出:连续测量Nmeas次之内,有超过或等于Nover次的测量的接收信号的强度大于−100dBm。

m0_73659489的博客 80

URL地址相对路径转绝对路径

URL相对路径转绝对路径在做爬虫或者网页解析时,经常会从网页中提取到很多相对URL,在做进一步爬取之前,我们需要将这个地址转成完整的URL,其实URL和文件路径是相似的,看似很简单,实则有很多情况需要考虑,网上提供的很多方法都会有各种各样的问题,这里提供了一个相对靠谱的方法,代码如下。echo PhpUri::doIt("https://www.google.com/", "foo"); //输出

zhyoulun的专栏 1万+

基于高斯两步移动搜寻法(2SFCA)的城市绿地可达性分析

第二步,对于每一个街道i,给定空间距离阈值d0,便形成另一个空间作用域,同样对于落在空间作用域内的每块绿地l的供给比率(Rl)利用高斯方程赋以权重,然后对这些加权后的供给比率(Rl)进行加和,便得到每个街道i的绿地可达性Ai。图3与图4是高斯两步移动搜索法的示例。在图3中,以d0为阈值,有1、2、3 三个街道中心点落在了绿地a的空间作用域内。同样在图4中,以d0为阈值,有a、c两个绿地中心点落在了街道2的空间作用域内,根据公式(3),对a、c高斯方程加权后的供需比率进行累加,便得到了街道2 的绿地可达性。

2301_77310370的博客 2409

Django路由参数

文章目录stringintslugpath正则多参 string # 默认就是string,类型名字可不指定 path('mystr/<theme>', views.mystr, name='mystr'), int path('myint/<int:age>', views.myint, name='myint'), slug path('my...

L_ZhouZhou的博客 751

NSIS教程(6): 使用第三方插件

NSIS内置了很多指令,这些指令可以满足我们基本需求,但难免会遇到NSIS没有内置的功能,如进程操作,后台运行(即多线程),7z压缩等等,这个时候我们就需要借助第三方插件来满足我们所需要的功能了。 一、插件获取 NSIS官方收录插件的网址是:http://nsis.sourceforge.net/Category:Plugins,我们可以在这个网站上查找和下载我们需要的插件,该网站上针对每

while(1) { smile(); } 9万+

小程序跳转链接实战:https://wxaurl.cn/、weixin://dl/business/ 跳转与明文 URL Scheme 生成指南

本文聚焦小程序跳转链接开发核心技术,深入解析 https://wxaurl.cn/*TICKET* 与 weixin://dl/business/?t= *TICKET* 两种链接的生成方法。详细阐述生成前的准备工作、服务端接口调用步骤及注意事项,同时剖析 iOS 与 Android 系统在链接适配方面的差异。此外,针对明文 URL Scheme 获取,从平台设置、拼接规则、使用限制等方面展开讲解,并结合实际应用案例提出优化建议,帮助开发者快速掌握小程序跳转链接生成与明文URL Scheme获取的关键技术。

邓邓子的博客 2万+

android 本地地址转换为url,android本地mipmap图片转url、绝对路径转URL URL URI File Path 转换...

标签: url uri file pathFile to URI:File file = ...;URI uri = file.toURI();File to URL:File file = ...;URL url = file.toURI().URL();URL to File:URL url = ...;File file = new Path(url.getPath()).toFile();...

weixin_35682097的博客 1093

【RT-DETR有效改进】为什么YOLO版本的RT-DETR训练模型不收敛精度差的问题

本文的内容同样为本专栏的前期预热文章,文章主要解释一下为什么有的人跑ultralytics仓库的RT-DETR精度很差,模型不收敛,mAP异常的情况。为了验证这一情况我也是跑了多个实验,从多个数据集出发,100-500的数据集我跑了大概5个数据集,1000的我跑了二个,2000的我跑了一个,4000的跑了一个,同时其中一些版本我也用了不同的batch_size来出发验证精度异常的情况。

Snu77的博客 9776

php 伪路径,PHP_php下实现伪 url 的超简单方法[转],就像我的日志中的地址路径一 - phpStudy...

php下实现伪 url 的超简单方法[转]就像我的日志中的地址路径一样,让 index.php?action=one&do=two变成: ?index/action/one/do/two复制代码 代码如下:index.php--------------// PARSING QUERY STRING$QS=explode("&",$_SERVER['QUERY_STRING']);$...

weixin_35666711的博客 491

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

java中Url处理

在开发爬虫的过程中会解析出Url地址,因为不同网站的不同风格,这些Url有些是相对路径,有些是绝对路径,有些是广告链接。 我们需要统一处理这些新的额Url1.过滤Url 假如我们想只采集一个网站的信息,就需要把和这个网站有关的Url放入queue 一般的方法是Regex 根据网站Url的特点编写,逐一匹配过滤Url。2.相对地址转绝对地址有些网站的Url采用相对地址,有些是绝对地址,绝对地址

keep_learn的专栏 996

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

本地路径没有转换为URL相对路径

使用OWC做了图表,发现在Visual Studio中测试,图表正常显示,网站发布后,发现图表不能显示,呈现为一个红色叉。原来是图片导出时,本地路径没有转换为URL相对路径。具体解决办法:       ///         ///本地路径没有转换为URL相对路径        ///         /// 本地路径         /// URL相对路径 private string urlconvertor(string imagesurl1)    {        string tmpRootDi

jingjing_amy的专栏 5324

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

android 本地地址转换为url,安卓 File和url之间的转换

转自:http://blog.sina.com.cn/s/blog_437ff56b0101dtrf.htmlFile to URI:File file = ...;URIuri= file.toURI();File to URL:File file = ...;URL url = file.toURI().URL();URL to File:URL url = ...;File file = n...

weixin_34189259的博客 2137

java 路径转url_Java路径的最终解决方案(转)

利用classpath的绝对路径,定位所有资源这个便利方法的实现原理,就是“利用classpath的绝对路径,定位所有资源”。ClassLoader类的getResource("")方法能够得到当前classpath的绝对路径,这是所有Java程序都拥有的能力,具有最大的适应性!而目前的JDK提供的ClassLoader类的getResource(String 相对路径)方法,只能接受一般的相对路...

weixin_31774841的博客 1768

将绝对路径变成URL路径(原创)

今天做了一个将绝对路径转换成URL路径的功能,在网上找了一下,一大堆代码 但是这些代码的功能都是“将绝对路径转换成相对路径”,并不能达到我要的效果, 我要的效果是“将绝对路径转换成URL路径”,该路径必须是一个完整的HTTP-URL路径 废话少说,贴代码: Code///<summary>///将绝对路径转换成相对路径///</summary...

weixin_30954607的博客 1095

https,http,本地 URL转InputStream

话不多说,上代码 public static InputStream byteByUrl(String urlOrPath) throws IOException { InputStream in = null; byte[] bytes; if (urlOrPath.toLowerCase().startsWith("https")) { bytes = HttpsUtils.doGet(urlOrPath);

qq_34829813的博客 4780

asp.net(C#)服务器绝对路径与URL相对路径互转

//服务器绝对路径转换成URL相对路径 private string urlconvertor(string imagesurl1) { //获取程序根目录 string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString()); //转换成URL相对路径 string imagesurl2 = imagesurl1.Repl

lyzyjoyo的专栏 7977

asp.net服务器绝对路径转换成URL相对路径

//本地路径转换成URL相对路径privatestringurlconvertor(stringimagesurl1){stringtmpRootDir=Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//获取程序根目录stringimagesurl...

weixin_30765577的博客 265

asp.net(C#)服务器绝对路径转换成URL相对路径[修改]

 //原创aloxy //2007.12.19 //本地路径转换成URL相对路径     private string urlconvertor(string imagesurl1)    {        string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.To

老杨的专栏 2704

springboot项目如何将本地资源路径映射成url路径

如何实现在项目中通过url路径访问本地磁盘的资源,将本地磁盘路径映射成虚拟路径 方式一:自定义类实现WebMvcConfigurer接口,重写它的addResourceHandlers(ResourceHandlerRegistry registry)方法。 import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.Resour

Sponge_boy的博客 2784
上一篇: 中英文切换
下一篇: 文件夹拿取文件 上传
王金洪0127
博客等级 码龄8年 7粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值