简体   繁体   English

在Laravel 5.2中调用未定义的方法Michelf \\ Markdown :: isDeferred()

[英]Call to undefined method Michelf\Markdown::isDeferred() in Laravel 5.2

I am going to use michelf/php-markdown package in my Laravel 5.2 application. 我将在Laravel 5.2应用程序中使用michelf / php-markdown软件包。
To install this package I added "michelf/php-markdown": "~1.6.0" to composer.json file and then I ran composer update command. 要安装此软件包,我在composer.json文件中添加了"michelf/php-markdown": "~1.6.0" ,然后运行composer update命令。
After this, I changed app.php file and added Michelf\\Markdown::class to Providers array and 'Markdown' => Michelf\\Markdown::class to aliases array. 此后,我更改了app.php文件,并将Michelf\\Markdown::class添加到Providers数组,并将'Markdown' => Michelf\\Markdown::class到别名数组。

But when I want to use this class: 但是当我想使用此类时:

public function store($request)
{
    $title = $request->title;
    $text= $request->text;
    $transformedText = Markdown::defaultTransform($text);
    dd($transformedQuestion);
}

I face this error: 我遇到这个错误:

FatalErrorException in C:\wamp\www\projects\stackoverflow\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php line 119:  

Call to undefined method Michelf\Markdown::isDeferred()

Is my way to install a package in Laravel wrong? 我在Laravel中安装软件包的方式是否错误?

I think it was my misunderstand about providers in Laravel. 我认为这是我对Laravel提供者的误解。
I removed Michelf\\Markdown::class from Providers array in app.php file and it worked. 我从app.php文件中的Providers数组中删除了Michelf\\Markdown::class ,它起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM