首页 \ 问答 \ 未定义的Laravel路径调用(Undefined Laravel path calls)

未定义的Laravel路径调用(Undefined Laravel path calls)

作为Laravel的首发,我遇到了以下问题:“框架调用给出了一个未定义的调用错误”。

运行版本:5.2.14

https://laravel.com/docs/5.0/helpers#paths

  • base_path获取应用程序安装根目录的完全限定路径。

  • config_path获取config目录的完全限定路径。

  • public_path获取公共目录的完全限定路径。

  • storage_path获取存储目录的标准路径。

看来我的intellisense正在看这些方法。 但是,当我打电话给他们时,它给我带来了未定义的方法错误。 我的home.blade.php文件:

<?php
$storage_path = storage_path();
echo $storage_path ?>

将导致:致命错误:调用未定义的函数storage_path()


As a Laravel starter I am stuck with the following problem: "Framework calls are giving a Undefined Call error".

running version: 5.2.14

https://laravel.com/docs/5.0/helpers#paths

  • base_path Get the fully qualified path to the root of the application install.

  • config_path Get the fully qualified path to the config directory.

  • public_path Get the fully qualified path to the public directory.

  • storage_path Get the fully qualified path to the storage directory.

It seems my intellisense is seeing these methodes. But when I do call them it is giving me a hard time with undefined methode errors. My home.blade.php file:

<?php
$storage_path = storage_path();
echo $storage_path ?>

Will result in: Fatal error: Call to undefined function storage_path()


原文:https://stackoverflow.com/questions/35242384
更新时间:2022-11-16 15:11

最满意答案

二级缓存的生命周期与会话工厂相关联,而不是与单个会话相关联。 一旦实体通过其唯一ID加载并且第二级缓存处于活动状态,该实体可用于(同一会话工厂的)所有其他会话。

因此,第二级仅适用于同一会话工厂的会话。

请查看NHibernate中的第一级和第二级缓存以获取更多详细信息


The life time of the second level cache is tied to the session factory and not to an individual session. Once an entity is loaded by its unique id and the second level cache is active the entity is available for all other sessions (of the same session factory).

So 2nd level works only thru sessions of the same session factory.

Please look First and Second Level caching in NHibernate for more details

相关问答

更多
  • Ayende在NHibernate中介绍了二级缓存的使用情况。 您将需要在Web场景中使用分布式缓存。 例如SysCache2(依赖于ASP.NET缓存,可以配置为使用分布式提供程序)或MemCache。 这里有一篇文章说明如何配置memcached。 Ayende blogged about 2nd level cache usage in NHibernate. You will need to use a distributed cache in a web farm scenario. For ex ...
  • sJHony我找到了解决方案,但对我来说更像是解决方法。 因此,如果你知道任何其他解决方案给我签名。 我利用QueryOver 没有任何转换 ,这个解决方案的错误在于查询返回的元素等于childs。 接下来,我使用distinct在内存中检索不是相乘的列表。 这个解决方案没问题,但是当我们再添加一个Fetch进行查询时,对象中的集合也会成倍增加,这就是我将集合类型从IList(Bag)修改为ISet(Set)的原因。 代码如下: var queryCacheResult = ...
  • 他们访问的数据存在一些重叠,因此需要共享二级缓存。 可能吗? 这将需要(这很可能过于简化): 能够从Java和.Net访问缓存。 为(N)Hibernate提供缓存提供程序实现。 能够以与两种语言兼容的格式读/写数据(或者没有共同的高速缓存)。 这听起来可行但是: 我不知道现有的即用型解决方案实现这个(我的第一个想法是Memcache,但AFAIK Memcache存储了数据的序列化版本,所以这不符合最重要的要求#3)。 我想知道使用语言中性格式来存储数据不会产生太多开销(并以某种方式破坏了使用缓存的目的) ...
  • 您应该在事务中运行它并在最后提交事务。 仅当事务已成功提交时,NHibernate才会更新二级缓存。 如果你没有启动NHibernate事务,NHibernate将不知道结果是否足以被缓存。 You should run this in a transaction and commit the transaction at the end. NHibernate updates the 2nd level cache only if the transaction has been committed su ...
  • 你确定你的实体在二级缓存中吗? 通常你必须在事务中工作和查询,以便二级缓存做任何事情。 are you sure that your entities are in the 2nd level cache. Normally you have to be working and querying within transactions in order for the 2nd level cache to do anything.
  • 您正在缓存查询结果,但不缓存您的实体(这些是单独的缓存)缓存查询的结果只存储ID; 如果你也没有缓存你的实体,那么会发出一个查询来加载每个返回的实体(这通常是坏的)MyDTO类的默认表名是MyDTO,所以它看起来就像这看起来像一个按ID查询,你不应该使用松散的命名查询,而应该使用正确的加载器。 (见17.4。加载自定义SQL)一旦设置了加载器和实体缓存,你就可以只使用session.Get(id)来检索你的对象,它将使用二级缓存,只要你在交易中完成所有工作,这是一种推荐的做法。 You are cachin ...
  • 我看到两个不同的东西作为你的观点的摘要: 使用redis作为NHB上方的二级缓存。 这非常有意义,因为SLC存储了对象的分隔字段,而redis是键/值存储。 我记得,SLC包含标量查询或映射和获取对象的结果,但重要的是,数据是从执行的查询中获取(缓存)的。 恕我直言,如果您以这种方式使用redis,所有缓存的值必须来自NHB查询。 这为您带来了某种事务原子性,您是如何描述的,但据我所知,当SCL从未提交的事务中返回陈旧数据或数据时,我们发现了一些错误。 请注意,这种方法表明某人(NHB)仍然需要以某种方式保 ...
  • config.Cache(x => x.Not.UseSecondLevelCache()); 解决了我的问题。 它删除了所有日志和不必要的cpu周期。 这是通过流利的。 如果您正在使用配置,则可能需要以下配置。 false config.Cache(x => x.Not.UseSecondLevelCache()); solved my problem. It removed a ...
  • 任何人都可以为Java EE 6应用程序推荐一个好的第二级对象缓存解决方案 虽然L2缓存合约在JPA 2.0中是标准化的,但L2缓存实现是特定于供应商的,您可能会也可能不会插入不同的L2缓存。 以防万一,请参阅第19.2章。 Hibernate的二级缓存 (正如您将看到的,问题没有一个答案,选择一个或另一个实现取决于您的需求和您使用缓存的方式)。 我特别担心必须将缓存客户端作为单线程/单例bean运行。 是这样的吗? 如果是这样,这是一个问题吗? 我不明白这个问题。 您不必担心任何事情,JPA提供程序与缓存 ...
  • 二级缓存的生命周期与会话工厂相关联,而不是与单个会话相关联。 一旦实体通过其唯一ID加载并且第二级缓存处于活动状态,该实体可用于(同一会话工厂的)所有其他会话。 因此,第二级仅适用于同一会话工厂的会话。 请查看NHibernate中的第一级和第二级缓存以获取更多详细信息 The life time of the second level cache is tied to the session factory and not to an individual session. Once an entity ...

相关文章

更多

最新问答

更多
  • 您如何使用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)