How do I use helper functions in Lumen?

让人想犯罪 __ 提交于 2020-05-11 10:35:28

问题


    $credentials = app_path();

Results in:

[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined function App\LtClasses\app_path()

But it's listed as a helper here: https://laravel.com/docs/5.3/helpers#method-app-path


回答1:


Those are the Laravel docs, you don't have the same helpers available on Lumen, you can have a look at the helpers that the Lumen framework comes with at

/vendor/laravel/lumen-framework/src/helpers.php

Workarounds to achive what you need here could be

app()->path();

app('path');

base_path('app');


来源:https://stackoverflow.com/questions/41101325/how-do-i-use-helper-functions-in-lumen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!