首页 \ 问答 \ Laravel 5之前的请求路径(Laravel 5 previous request path)

Laravel 5之前的请求路径(Laravel 5 previous request path)

Laravel中是否有任何内置方法来获取上一个URL的路径?

我知道url()->previous(); 但我只想得到以前的路径。 此外,我可以从以前的URL中提取以前的路径。 但是我想知道Laravel中是否有任何内置方法。


Is there any built-in method in Laravel to get the path of the previous URL?

I know about url()->previous(); but i only want to get previous path. Also, I can extract previous path from the previous URL. But I would like to know if there is any built-in method in Laravel.


原文:https://stackoverflow.com/questions/47110513
更新时间:2023-05-25 20:05

最满意答案

您不需要Enumerable.RangeZip方法,因为您可以使用为您提供索引的Select重载:

var dict = File.ReadLines(wordsFile)
    .Select((word, index) => new { word, index })
    .ToDictionary(x => x.word, x => x.index + 1);

You don't need the Enumerable.Range and Zip approach since you can use the Select overload that gives you the index:

var dict = File.ReadLines(wordsFile)
    .Select((word, index) => new { word, index })
    .ToDictionary(x => x.word, x => x.index + 1);

相关问答

更多
  • 在基于范围的for循环中,非成员begin()和end()名称查找仅使用ADL。 它不执行普通的不合格查找。 §6.5.4[stmt.ranged] /p1.3: 如果_RangeT是一个类类型,那么在类_RangeT的范围内查找非限定id的begin和end就好像通过类成员访问查找(3.4.5)一样,并且如果(或两者)至少发现一个声明, [...] 否则, begin-expr和end-expr分别是begin(__range)和end(__range) , begin和end在相关的命名空间(3.4.2 ...
  • 向后阅读文本文件真的很棘手,除非您使用固定大小的编码(例如ASCII)。 当您具有可变大小编码(例如UTF-8)时,您将不得不检查在获取数据时是否位于字符中间。 框架中没有内置的东西,我怀疑你必须为每个变宽编码分别进行硬编码。 编辑:这已经有些测试 - 但这并不是说它还没有一些细微的错误。 它使用MiscUtil的StreamUtil,但是我已经从底部添加了必要的(新)方法。 哦,它需要重构 - 有一个非常大的方法,你会看到: using System; using System.Collections; ...
  • 这条规则以及其他一些相关规则在Eric Lippert的博客文章中讨论。 这里违反的特定规则是: 2)在同一局部变量声明空间或嵌套局部变量声明空间中有两个相同名称的局部变量是非法的。 特别值得注意的是,至于规则存在的原因如下: 所有这些规则的目的都是为了防止代码的读者/维护者被欺骗的错误类别认为他们所指的是一个具有简单名称的实体,但实际上是完全意指另一个实体。 这些规则特别旨在防止执行应该是安全重构时的令人讨厌的意外。 通过允许您描述的内容可能会导致看似良性的重构,例如将for循环移到另一个声明之后,从而导 ...
  • C#/ .Net迭代器(由IEnumerable返回的IEnumerable )是只读向前的迭代器,与Java的iterator.remove相比,不允许从底层集合中删除项目。 大多数集合支持通过索引删除项目,如List.RemoveAt ,它们将近似等效。 或者,如果您只想在迭代期间跳过项目 - Enumarable.Skip或Enumerable.Where可以是一个选项: mySequence.Where((item,id) => id != indexToSkip) C#/ ...
  • 如果所有的“片段”都是可Clone则迭代器通常都是可Clone 。 在my_iter中你有几个不是这样的:匿名闭包(就像flat_map中的那个)和to_uppercase返回的ToUppercase结构。 你可以做的是: 重建整个事情(如@ArtemGr建议)。 你可以使用宏来避免重复。 有点丑,但应该工作。 在填充my_struct之前收集my_iter到一个Vec (因为您好像在那里收集它): let my_iter: Vec = my_string.unwrap_or("A").char ...
  • 真的有关系吗? 这些是你必须尽量避免恕我直言的微观优化类型。 此外,即使迭代时间在地图上的大量元素中发生变化,您尝试遍历如此大地图的所有元素的事实意味着最有可能您选择了错误的数据结构。 Does it really matter? these are the types of the micro optimizations you must try to avoid IMHO. Also, even if the iteration time changes for very large number of ...
  • 您不需要Enumerable.Range和Zip方法,因为您可以使用为您提供索引的Select重载: var dict = File.ReadLines(wordsFile) .Select((word, index) => new { word, index }) .ToDictionary(x => x.word, x => x.index + 1); You don't need the Enumerable.Range and Zip approach since you can ...
  • 您可以放弃foreach并直接处理IEnumerator 。 using (IEnumerator<> enumerator = dict.GetEnumerator()) { while (enumerator.MoveNext()) { DoSomething(enumerator.Current); if (condition) break; } while (enume ...
  • 你看过莎莉了吗? 我没有使用它,但它看起来很相关 Have you looked at sary? I haven't used it but it looks relevant
  • 我认为你应该使用CRTP( https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern )。 喜欢这个: template struct iiterator_t { typedef T value_type; typedef T& reference; typedef T* pointer; typedef ItT iterator_type; ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)