url 相关问题

URL(统一资源定位符)是Web上的通用标识符。 URL是对特定位置的Web资源的引用,并提供了检索该资源的方法。

加载网络图片失败

我正在创建一个 flutter web 应用程序,我的应用程序不会专门显示来自 FirebaseStorage 的图像。我从 firebasestorage 获得了正确的下载 URL,但 NetworkImage 和 Image.network 不会显示

回答 1 投票 0

flutter 无法打开启动 Url google Drive

当我调用launchUrl(url_launcher 6.2.2)时 它不起作用或表现不佳。 我想用链接打开古尔驱动器。 Final Uri url = Uri.parse("googel 驱动器链接分享给所有人"); ...

回答 1 投票 0

在本地主机和实时服务器中更改 api url

我已经使用代理在本地主机中调用了外部 api,它工作正常,但是当我在实时服务器中调用它时,代理将更改为我给出的服务器 url + api 我想要的网址是

回答 1 投票 0

Django 动态 URL 模式返回 404

我目前正在构建一个 Django CMS 应用程序。 当我尝试使用动态 url 模式时,我只得到 404。 调试=真 返回: 使用 myproject.urls 中定义的 URLconf,Django 尝试了这些 URL 模式,...

回答 1 投票 0

过滤必须包含特定文本且不包含其他文本的网址数组

我想从网站中提取特定链接。 链接看起来像这样: /主题/有趣/G1pdeJm 链接始终相同 - 除了最后一个随机字符。 我很难将这些结合起来......

回答 2 投票 0

如何获取斜线后的url最后一部分作为php中的获取值

我的网址如下所示:http://localhost/event_manage?slug=hello,最后一个值如 hello 因此,当我访问 http://localhost/event_manage/hello 时,该页面位于 index.php 中并显示错误,因为我...

回答 2 投票 0

为什么路径转换器中需要 to_url() 方法?姜戈

为什么我需要 Django 路径转换器中的 to_url(self, value) 方法? 我在官方文档上只能找到几个例子,无法理解这个方法的用法。 to_url() 到底做了什么?

回答 4 投票 0

自动链接页脚中的每个页面 PHP / jQuery 中的下一页和上一页导航

我有 100 个 php 页面,而且全都是静态页面。我希望在每个页脚中都有下一页/上一页链接,该链接应该自动工作,而不是手动设置。所有页面都...

回答 1 投票 0

请建议 Fiddler Core 3rd 方库的替代方案

我正在开发一个应用程序,在其中监视互联网流量(使用 Fiddler Core),如果应用程序发现 URL 不值得信任,那么它不会让用户访问它....

回答 2 投票 0

到达我的 Web API 端点 asp.net 的正确 URL 是什么?

我正在 asp.net 中使用 API,并尝试从 JavaScript 文件中获取它,但我认为我的 URL 有问题。这是我的控制器和我想要达到的方法: ...

回答 1 投票 0

Python3 - parse_qs 没有按预期分隔参数

我正在Python3中使用urllib库。代码: 从 urllib.parse 导入 parse_qs parse_qs('https://www.example.com/?api-url=%2Fp%2Ftest-test-test-000761di%3Fajax%3Dtrue&api-params=%3Ft%3Ds...

回答 1 投票 0

如何更改用户在 Django 中复制的 URL?

构建 DJANGO 应用程序。当您单击“复制链接”时,我的其中一个页面上的所有链接都不会返回链接 URL,而是返回我在自定义函数中触发的 GET 命令,以便上下文单击链接

回答 1 投票 0

使用 boost::spirit::x3 进行 URL 解析

我正在尝试使用 boost::spirit::x3 将 URL 解析和分解为多个部分,如下所示: #包括 #包括 #包括 我正在尝试使用 boost::spirit::x3 将 URL 解析和分解为多个部分,如下所示: #include <iostream> #include <boost/fusion/adapted/std_tuple.hpp> #include <boost/fusion/adapted/struct.hpp> #include <boost/spirit/home/x3.hpp> struct UrlParts { std::string prefix, host, suffix; }; BOOST_FUSION_ADAPT_STRUCT(UrlParts, prefix, host, suffix) UrlParts parseSpirit(std::string_view input) { namespace x3 = boost::spirit::x3; static const auto scheme_ = (x3::raw[+x3::char_("a-zA-Z0-9+.-") >> "://"]); static const auto userinfo_ = (x3::raw[+~x3::char_("@") >> "@"]); static const auto prefix_ = (-scheme_ >> -userinfo_); static const auto port_ = (x3::raw[':' >> -x3::repeat(1, 5)[x3::digit] >> &(x3::char_("/?#") | x3::eoi)]); static const auto host_ = (+(x3::char_("a-fxXA-F0-9:.") - port_)); static const auto path_ = (x3::char_("/?#") >> *x3::char_); // to store path+query+fragment static const auto suffix_ = (-port_ >> -path_); //static const auto url = x3::rule<class url, UrlParts>() = -prefix_ >> ('[' >> host_ >> ']' | host_) >> -suffix_; static const auto url = -prefix_ >> ('[' >> host_ >> ']' | host_) >> -suffix_; // prefix & suffix are optional but host is required // BOOST_SPIRIT_DEBUG_NODES((scheme_)(userinfo_)(host_)(port_)(path_)(url)); // Parse the input auto iter = input.begin(); auto end = input.end(); UrlParts parts; auto attr = std::tie(parts.prefix, parts.host, parts.suffix); //parse(input.begin(), input.end(), x3::eps >> url >> x3::eoi, parts); bool ret = x3::parse(iter, end, url >> x3::eoi, attr); if (!ret) { std::cout << "Parsing failed" << std::endl; } return parts; } int main() { for (auto input : {"http://usr:[email protected]:8080/file.php?abc=1#23", "http://[::ffff:192.168.1.1]:8080/file.php?abc=1#23", "http://::ffff:192.168.1.1/file.php?abc=1#23", "::ffff:192.168.1.1" }) { std::cout << "Input: " << input << std::endl; auto parts = parseSpirit("http://usr:[email protected]/file.php?abc=1"); std::cout << "Output: Prefix: " << parts.prefix << ", Host: " << parts.host << ", Suffix: " << parts.suffix << std::endl; std::cout << "================" << std::endl; } return 0; } 但是上面的代码无法编译并出现错误: /usr/include/boost/spirit/home/x3/operator/detail/sequence.hpp:140:25: error: static assertion failed: Size of the passed attribute is less than expected. 140 | actual_size >= expected_size | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/boost/spirit/home/x3/operator/detail/sequence.hpp:140:25: note: ‘(((int)boost::spirit::x3::detail::partition_attribute >, boost::spirit::x3::literal_string > > >, boost::spirit::x3::optional > >, boost::spirit::x3::literal_char > > > > >, boost::spirit::x3::alternative, boost::spirit::x3::plus, boost::spirit::x3::raw_directive, boost::spirit::x3::optional, boost::spirit::x3::detail::finite_count > > >, boost::spirit::x3::and_predicate, boost::spirit::x3::eoi_parser> > > > > > >, boost::spirit::x3::literal_char >, boost::spirit::x3::plus, boost::spirit::x3::raw_directive, boost::spirit::x3::optional, boost::spirit::x3::detail::finite_count > > >, boost::spirit::x3::and_predicate, boost::spirit::x3::eoi_parser> > > > > > > >, boost::spirit::x3::optional, boost::spirit::x3::optional, boost::spirit::x3::detail::finite_count > > >, boost::spirit::x3::and_predicate, boost::spirit::x3::eoi_parser> > > > >, boost::spirit::x3::optional, boost::spirit::x3::kleene > > > > >, std::tuple, std::allocator >&, std::__cxx11::basic_string, std::allocator >&, std::__cxx11::basic_string, std::allocator >&>, boost::spirit::x3::unused_type, void>::actual_size) >= ((int)boost::spirit::x3::detail::partition_attribute >, boost::spirit::x3::literal_string > > >, boost::spirit::x3::optional > >, boost::spirit::x3::literal_char > > > > >, boost::spirit::x3::alternative, boost::spirit::x3::plus, boost::spirit::x3::raw_directive, boost::spirit::x3::optional, boost::spirit::x3::detail::finite_count > > >, boost::spirit::x3::and_predicate, boost::spirit::x3::eoi_parser> > > > > > >, boost::spirit::x3::literal_char >, boost::spirit::x3::plus, boost::spirit::x3::raw_directive, boost::spirit::x3::optional, boost::spirit::x3::detail::finite_count > > >, boost::spirit::x3::and_predicate, boost::spirit::x3::eoi_parser> > > > > > > >, boost::spirit::x3::optional, boost::spirit::x3::optional, boost::spirit::x3::detail::finite_count > > >, boost::spirit::x3::and_predicate, boost::spirit::x3::eoi_parser> > > > >, boost::spirit::x3::optional, boost::spirit::x3::kleene > > > > >, std::tuple, std::allocator >&, std::__cxx11::basic_string, std::allocator >&, std::__cxx11::basic_string, std::allocator >&>, boost::spirit::x3::unused_type, void>::expected_size))’ evaluates to false 有什么问题的建议吗?与 boost::spirit::qi 类似的代码可以正常工作。 此外,我有兴趣了解是否有更有效的方法来执行此操作,例如:使用 string_view 而不是 string,因为所有 3 个部分都存在于输入视图中。 预先感谢! 这意味着属性未被检测为与解析器表达式兼容。看到它在 1.76 中被破坏了: 我看到的第一个问题是尝试从两个 prefix 指令合成单个字符串 (raw[])。那是...行不通的。 好消息是它可以(再次?)从 1.77 开始,但总的来说,考虑对属性兼容性更明确一点,就像这个答案中的 as_type 理解 Boost.Spirit 中的列表运算符 (%) ,或许多其他https://stackoverflow.com/search?tab=newest&q=user%3a85371%20x3%20as_type&searchOn=3,甚至更多,如果你寻找我通常更喜欢的名字as...... https://stackoverflow.com/search?q=user%3A85371+x3+as+x3%3A%3Arule 也就是说,当我查看你的代码时,你绑定了一个手动绑定的元组AND不知何故仍然适应结构?那是多余的。我假设您只想手动绑定,所以放弃适应。 接下来,无论如何,不要使用解析器组合器库作为标记器。即,不要随机地将不相关的产品组合在一起(后缀确实不应包含端口规范)。 此外,使用整数解析器解析为真实的端口号。当然,如果您无论如何都要“迂腐”地严格限制允许的位数!请看这里: auto portnum_ = x3::uint_parser<uint16_t, 10, 1, 5>{}; auto portspec_ = ':' >> portnum_ >> &(x3::char_("/?#") | x3::eoi); 小心双重可选性。例如。由于 suffix_ = -port_ >> -path_ 从字面上看只有可选元素,因此表达式 -suffix_ 充其量与 suffix_ 具有相同的含义。但是,在很多情况下(可选的重复结构),您将获得零长度匹配的无限循环。我想/或#也应该结束用户信息的产生。并非所有事情都需要raw。例如。我更愿意auto userinfo_ = +~x3::char_("@/#") >> x3::char_("@"); 用于用户信息。事实上,如果你这样做 auto authority_ = ('[' >> host_ >> ']' | host_) >> -portspec_; 您将正确获取解析后的主机,无需使用 [] 括号,该括号仅在 URI 语法中有意义。您已注释掉输入结束验证,让我们重新启用它们。我们还返回更多丰富的信息(包括 valid 标志)和更多测试用例:实时编译器资源管理器 #include <boost/fusion/adapted/std_tuple.hpp> #include <boost/spirit/home/x3.hpp> #include <iostream> struct UrlParts { std::string prefix, host, suffix; }; UrlParts parseSpirit(std::string_view input) { namespace x3 = boost::spirit::x3; auto scheme_ = x3::raw[+x3::char_("a-zA-Z0-9+.-") >> "://"]; auto userinfo_ = x3::raw[+~x3::char_("@") >> "@"]; auto prefix_ = scheme_ >> -userinfo_; auto port_ = x3::raw[':' >> -x3::repeat(1, 5)[x3::digit] >> &(x3::char_("/?#") | x3::eoi)]; auto host_ = +(x3::char_("a-fxXA-F0-9:.") - port_); auto path_ = x3::char_("/?#") >> *x3::char_; // to store path+query+fragment auto suffix_ = -port_ >> -path_; // static const auto url = = -prefix_ >> ('[' >> host_ >> ']' | host_) >> // -suffix_; auto url // //= x3::rule<class url, UrlParts>() // = -prefix_ // //>> ('[' >> host_ >> ']' | host_) >> // -suffix_ // prefix & suffix are optional but host is required ; // Parse the input auto iter = input.begin(); auto end = input.end(); UrlParts p; auto attr = std::tie(p.prefix/*, p.host, p.suffix*/); bool ret = x3::parse(iter, end, url >> x3::eoi, attr); if (!ret) { std::cout << "Parsing failed" << std::endl; } return p; } int main() { for (auto input : {"http://usr:[email protected]:8080/file.php?abc=1#23", "http://[::ffff:192.168.1.1]:8080/file.php?abc=1#23", "http://::ffff:192.168.1.1/file.php?abc=1#23", "::ffff:192.168.1.1"}) { std::cout << "Input: " << input << std::endl; auto parts = parseSpirit("http://usr:[email protected]/file.php?abc=1"); std::cout << "Output: Prefix: " << parts.prefix << ", Host: " << parts.host << ", Suffix: " << parts.suffix << std::endl; std::cout << "================" << std::endl; } } 印刷 192.168.1.1 {true, "", "", "192.168.1.1", "", unspecified} 192.168.1.1/ {true, "", "", "192.168.1.1", "/", unspecified} 192.168.1.1/file.php {true, "", "", "192.168.1.1", "/file.php", unspecified} 192.168.1.1/file.php?abc=1 {true, "", "", "192.168.1.1", "/file.php?abc=1", unspecified} 192.168.1.1:8888 {true, "", "", "192.168.1.1", "", 8888} 192.168.1.1:8888/ {true, "", "", "192.168.1.1", "/", 8888} 192.168.1.1:8888/file.php {true, "", "", "192.168.1.1", "/file.php", 8888} 192.168.1.1:8888/file.php?abc=1 {true, "", "", "192.168.1.1", "/file.php?abc=1", 8888} ::ffffff::192.168.1.1:9999/file.php?abc=1 {true, "", "", "::ffffff::192.168.1.1", "/file.php?abc=1", 9999} http://192.168.1.1 {true, "http://", "", "192.168.1.1", "", unspecified} http://192.168.1.1/ {true, "http://", "", "192.168.1.1", "/", unspecified} http://192.168.1.1/file.php {true, "http://", "", "192.168.1.1", "/file.php", unspecified} http://192.168.1.1/file.php?abc=1 {true, "http://", "", "192.168.1.1", "/file.php?abc=1", unspecified} http://192.168.1.1:8888 {true, "http://", "", "192.168.1.1", "", 8888} http://192.168.1.1:8888/ {true, "http://", "", "192.168.1.1", "/", 8888} http://192.168.1.1:8888/file.php {true, "http://", "", "192.168.1.1", "/file.php", 8888} http://192.168.1.1:8888/file.php?abc=1 {true, "http://", "", "192.168.1.1", "/file.php?abc=1", 8888} http://::ffffff::192.168.1.1:9999/file.php?abc=1 {true, "http://", "", "::ffffff::192.168.1.1", "/file.php?abc=1", 9999} http://[email protected] {true, "http://", "sehe@", "192.168.1.1", "", unspecified} http://[email protected]/ {true, "http://", "sehe@", "192.168.1.1", "/", unspecified} http://[email protected]/file.php {true, "http://", "sehe@", "192.168.1.1", "/file.php", unspecified} http://[email protected]:8888 {true, "http://", "sehe@", "192.168.1.1", "", 8888} http://[email protected]:8888/ {true, "http://", "sehe@", "192.168.1.1", "/", 8888} http://[email protected]:8888/file.php {true, "http://", "sehe@", "192.168.1.1", "/file.php", 8888} http://usr:[email protected]/file.php?abc=1 {true, "http://", "usr:pwd@", "192.168.1.1", "/file.php?abc=1", unspecified} [email protected] {true, "", "sehe@", "192.168.1.1", "", unspecified} [email protected]/ {true, "", "sehe@", "192.168.1.1", "/", unspecified} [email protected]/file.php {true, "", "sehe@", "192.168.1.1", "/file.php", unspecified} [email protected]:8888 {true, "", "sehe@", "192.168.1.1", "", 8888} [email protected]:8888/ {true, "", "sehe@", "192.168.1.1", "/", 8888} [email protected]:8888/file.php {true, "", "sehe@", "192.168.1.1", "/file.php", 8888} usr:[email protected]/file.php?abc=1 {true, "", "usr:pwd@", "192.168.1.1", "/file.php?abc=1", unspecified} 但是等等 - 问题是什么? 如果您必须使用旧的 Boost 版本,我们会看到 问题又回来了... 因此,让我们通过在用户信息周围重新设置 raw[] 作为提示来解决这个问题。显然我宁愿升级 Boost:auto userinfo_ = x3::raw[+~x3::char_("@/#") >> x3::char_("@")]; 在 Boost 1.76 上查看它:https://godbolt.org/z/6bc5Ycrcr 输出相同,md5 校验和: c69881691195579e3184ef6024136356 1.76 c69881691195579e3184ef6024136356 1.84

回答 1 投票 0

urllib.request.urlopen(url) 带身份验证

这几天我一直在玩漂亮的汤和解析网页。我一直在使用一行代码,它在我编写的所有脚本中都是我的救星。该行代码是: r =

回答 5 投票 0

抓取特定电影的所有烂番茄观众评论

我正在尝试在烂番茄上抓取某部电影的所有观众评论。每个评论页面显示 20 条评论,并有一个“加载更多”按钮,以便显示接下来的 20 条评论,...

回答 1 投票 0

如何为现有查询字符串 Blazor 设置新值

我正在尝试更改查询字符串参数而不重新加载页面。我有一个 DateTime 日期值,我试图将其转换为字符串并放入 url 中。说吧,为了这个

回答 1 投票 0

检查 URL/IP 和端口

我的 Java 11/Android 应用程序必须检查用户输入的 URL/IP 理论上是否有效(使用 myURL.trim().matches(regex))。 什么应该是有效的(包括变体): stackoverflow.com ...

回答 4 投票 0

获取两个绝对URL之间的相对URL

给定两个绝对URL: const from = new URL("https://example.com") const to = new URL("https://example.com/about") 有没有一种简单可靠的方法来获得相对网址投注...

回答 1 投票 0

将带有查询字符串的 URL 转换为“搜索引擎友好”URL

我想知道是否可以重写为htaccess中的重写而设计的URL。 例如 我有网址:http://example.com/page.php?page=5&action=something 但我想改变...

回答 1 投票 0

PHP - str_replace 不适用于 URL 变量字符串

我正在将 URL 变量构建到另一个名为“$url”的变量中: $url = "page2.php?"; $url .= "&Keyword=$keyword"; $shopByStore = $_GET["商店"]; 如果(!空($

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.