在刀片服务器中访问Laravel .env变量 [英] Accessing Laravel .env variables in blade

查看:73
本文介绍了在刀片服务器中访问Laravel .env变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取一些API密钥,这些密钥已存储在.env文件中,可在刀片javascript中使用.我添加了两个键,例如:

I am trying to get some API keys which I have stored in my .env file to use in the blade javascript. I have added two keys like:

APP_ENV=local
APP_KEY=////
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
APP_GOOGLE_MAPS=////
APP_OVERHEID_IO=////

在刀片服务器中,我需要使用Google Maps API和OverheidIO API密钥.我尝试获取默认的.env变量之一,以防万一我格式化自定义.env变量的格式错误.

In blade I need to use the Google Maps API and OverheidIO API key. I have tried getting one of the default .env variables just in case I have formatted the custom .env variables wrong.:

{{ env('APP.ENV') }} // nothing
{{ env('APP_ENV') }} // nothing
{{ env('APP_ENV'), 'test' }} // returns 'test' 

有人可以帮我在刀片中调用Google Maps API和Overheidio API密钥吗?

Could someone help me call the google maps api and overheidio api key in the blade?

推荐答案

五个最重要的命令,如果您的Laravel在.env或数据库文件夹中进行了某些修改或由于其他任何修改而无法按预期工作时. 这里是完整的解释: https://www.youtube.com/watch?v=Q1ynDMC8UGg

Five most important commands if your Laravel is not working as expected after some modifications in .env or database folder or because of any other modifications. Here is full explanation: https://www.youtube.com/watch?v=Q1ynDMC8UGg

php artisan config:clear
php artisan cache:clear
composer dump-autoload
php artisan view:clear
php artisan route:clear

这篇关于在刀片服务器中访问Laravel .env变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆