问答详情
源自:2-4 Laravel-通过表单实现新增及操作状态提示功能

非静态方法getpathinfo无法静态调用

在左侧栏链接的状态显示中

使用Request::getPathInfo()=="url"?"active":“”

会提示Non-static method cant called statically

这要如何处理?

查询过百度,通过应用(new \Illuminate\Http\Request())->getPathInfo()

不会报错,但却无效果

提问者:wyh_ 2017-09-17 01:50

个回答

  • qq_执着_0
    2018-10-21 00:34:36

    request()->path()=='student/index'?'active':''}}">完美解决问题


  • qq_很2很温柔_0
    2017-10-27 16:23:57

    request()->getPathInfo() 用这个代替试试看