Laravel 5 Laravel 5.5方法getPath不存在

Laravel 5 Laravel 5.5方法getPath不存在,laravel-5,Laravel 5,安装了composer,并使用Laravel 5.5.22重新安装了一个新的Laravel项目(Laravel新测试)。调用内置方法getPath()(在Laravel5.4和PHP5.6中使用)不再有效。我怎样才能修好它 PHP版本: 7.1.11-1+ubuntu14.04.1+deb.sury.org+1 Composer版本和软件包: kevin@kevin-lt:/usr/local/bin$ composer self-update You are already using co

安装了composer,并使用Laravel 5.5.22重新安装了一个新的Laravel项目(Laravel新测试)。调用内置方法getPath()(在Laravel5.4和PHP5.6中使用)不再有效。我怎样才能修好它

PHP版本:

7.1.11-1+ubuntu14.04.1+deb.sury.org+1
Composer版本和软件包:

kevin@kevin-lt:/usr/local/bin$ composer self-update
You are already using composer version 1.5.3 (stable channel).

kevin@kevin-lt:/var/www/test$ composer show
dnoegel/php-xdg-base-dir              0.1     implementation of xdg base   directory specification for php
doctrine/inflector                    v1.2.0  Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                 1.1.0   A small, lightweight utility to instantiate objects in PHP without invoking...
doctrine/lexer                        v1.0.1  Base library for a lexer that can be used in Top-Down, Recursive Descent Pa...
egulias/email-validator               2.1.3   A library for validating emails against several RFCs
erusev/parsedown                      1.6.4   Parser for Markdown.
fideloper/proxy                       3.3.4   Set trusted proxies for Laravel
filp/whoops                           2.1.14  php error handling for cool kids
fzaninotto/faker                      v1.7.1  Faker is a PHP library that generates fake data for you.
hamcrest/hamcrest-php                 v2.0.0  This is the PHP port of Hamcrest Matchers
jakub-onderka/php-console-color       0.1    
jakub-onderka/php-console-highlighter v0.3.2 
laravel/framework                     v5.5.22 The Laravel Framework.
laravel/tinker                        v1.0.2  Powerful REPL for the Laravel framework.
league/flysystem                      1.0.41  Filesystem abstraction: Many filesystems, one API.
mockery/mockery                       1.0     Mockery is a simple yet flexible PHP mock object framework for use in unit ...
monolog/monolog                       1.23.0  Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/cron-expression             v1.2.1  CRON for PHP: Calculate the next or previous run date and determine if a CR...
myclabs/deep-copy                     1.7.0   Create deep copies (clones) of your objects
nesbot/carbon                         1.22.1  A simple API extension for DateTime.
nikic/php-parser                      v3.1.2  A PHP parser written in PHP
paragonie/random_compat               v2.0.11 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                      1.0.1   Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                       1.0.1   Library for handling version information and constraints
phpdocumentor/reflection-common       1.0.1   Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock     4.2.0   With this component, a library can provide support for annotations via DocB...
phpdocumentor/type-resolver           0.4.0  
phpspec/prophecy                      1.7.3   Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage             5.2.4   Library that provides collection, processing, and rendering functionality f...
phpunit/php-file-iterator             1.4.5   FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template             1.2.1   Simple template engine.
phpunit/php-timer                     1.0.9   Utility class for timing
phpunit/php-token-stream              2.0.2   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                       6.5.0   The PHP Unit Testing framework.
phpunit/phpunit-mock-objects          5.0.0   Mock Object library for PHPUnit
psr/container                         1.0.0   Common Container Interface (PHP FIG PSR-11)
psr/log                               1.0.2   Common interface for logging libraries
psr/simple-cache                      1.0.0   Common interfaces for simple caching
psy/psysh                             v0.8.15 An interactive shell for modern PHP.
ramsey/uuid                           3.7.1   Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1...
sebastian/code-unit-reverse-lookup    1.0.1   Looks up which function or method a line of code belongs to
sebastian/comparator                  2.1.0   Provides the functionality to compare PHP values for equality
sebastian/diff                        2.0.1   Diff implementation
sebastian/environment                 3.1.0   Provides functionality to handle HHVM/PHP environments
sebastian/exporter                    3.1.0   Provides the functionality to export PHP variables for visualization
sebastian/global-state                2.0.0   Snapshotting of global state
sebastian/object-enumerator           3.0.3   Traverses array structures and object graphs to enumerate all referenced ob...
sebastian/object-reflector            1.1.1   Allows reflection of object attributes, including inherited and non-public ...
sebastian/recursion-context           3.0.0   Provides functionality to recursively process PHP variables
sebastian/resource-operations         1.0.0   Provides a list of PHP built-in functions that operate on resources
sebastian/version                     2.0.1   Library that helps with managing the version number of Git-hosted PHP projects
swiftmailer/swiftmailer               v6.0.2  Swiftmailer, free feature-rich PHP mailer
symfony/console                       v3.4.0  Symfony Console Component
symfony/css-selector                  v3.4.0  Symfony CssSelector Component
symfony/debug                         v3.4.0  Symfony Debug Component
symfony/event-dispatcher              v4.0.0  Symfony EventDispatcher Component
symfony/finder                        v3.4.0  Symfony Finder Component
symfony/http-foundation               v3.4.0  Symfony HttpFoundation Component
symfony/http-kernel                   v3.4.0  Symfony HttpKernel Component
symfony/polyfill-mbstring             v1.6.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php70                v1.6.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/process                       v3.4.0  Symfony Process Component
symfony/routing                       v3.4.0  Symfony Routing Component
symfony/translation                   v3.4.0  Symfony Translation Component
symfony/var-dumper                    v3.4.0  Symfony mechanism for exploring and dumping PHP variables
theseer/tokenizer                     1.1.0   A small library for converting tokenized PHP source code into XML and poten...
tijsverkoyen/css-to-inline-styles     2.2.0   CssToInlineStyles is a class that enables you to convert HTML-pages/files i...
vlucas/phpdotenv                      v2.4.0  Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVE...
webmozart/assert                      1.2.0   Assertions to validate method input/output with nice error messages.
routes/web.php

Route::get('/', 'PagesController@home');
控制器/PagesController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Router;

class PagesController extends Controller
{

    /**
     * 
     * @return type
     */
    public function home(Router $route){

        $this->filterRoutes($route);
    }

    public function filterRoutes($route) {
        $r = $route->getRoutes();
        foreach ($r as $value) {

            dd($value->getPath());

        }
    }
}

如果您在使用laravel的同时使用Ubuntu操作系统,那么请确保您已授予项目文件夹777权限

首先,您必须为getting视图编写路由,然后使用post路由在该页面上传递数据

就像下面我粘贴在这里的代码一样

Route::get('password/change', 'UserController@reset_password_form');
Route::post('password/change', 'UserController@reset_password');
我首先使用get方法调用view页面,然后使用post方法显示或执行功能


如果您在使用laravel时使用Ubuntu操作系统,请随时询问是否有任何疑问,然后确保您已授予777项目文件夹的权限

首先,您必须为getting视图编写路由,然后使用post路由在该页面上传递数据

就像下面我粘贴在这里的代码一样

Route::get('password/change', 'UserController@reset_password_form');
Route::post('password/change', 'UserController@reset_password');
我首先使用get方法调用view页面,然后使用post方法显示或执行功能


如果有任何疑问,请随时询问您可以使用
$value->URI
获取URI

$r = $route->getRoutes();
foreach ($r as $value) {

    echo($value->uri());
}

您可以使用
$value->URI
获取URI

$r = $route->getRoutes();
foreach ($r as $value) {

    echo($value->uri());
}

我已经将$value->getPath()更改为$value->uri(),现在在我的下一个方法调用中出错了(不是在原始帖子中)。现在它说getMethods方法不存在。这些方法(getPath和getMethods)是否已被弃用?返回['path'=>$value->uri(),'method'=>$value->getMethods()[0],'action'=>$action[1]];看起来我可以用RouteCollection方法代替getMethods。我将尝试一下,看看它是否有效。对于getMethods(),我可以用$value->methods[0]替换它。它正在工作。非常感谢。仔细阅读api文档。路由有几种获取自身信息的方法。:)我已经将$value->getPath()更改为$value->uri(),现在它在我的下一个方法调用中出错了(不是在原始帖子中)。现在它说getMethods方法不存在。这些方法(getPath和getMethods)是否已被弃用?返回['path'=>$value->uri(),'method'=>$value->getMethods()[0],'action'=>$action[1]];看起来我可以用RouteCollection方法代替getMethods。我将尝试一下,看看它是否有效。对于getMethods(),我可以用$value->methods[0]替换它。它正在工作。非常感谢。仔细阅读api文档。路由有几种获取自身信息的方法。:)