【问题标题】:laravel 5.2 config constant does not work on serverlaravel 5.2 配置常量在服务器上不起作用
【发布时间】:2017-06-12 06:26:20
【问题描述】:

我将我的字符串分开并将它们放在 textConstant.php 文件中的 Constant 目录中,在我的本地主机中一切正常,但是当我在服务器上上传我的代码时,字符串淡出并且我的屏幕上什么也没有显示,

这是我的常量文件:

return [
        'title' => 'test',
         'book' => 'book_test',
       ];

这是我使用常量的代码:

  <button>{{config('Constants.textConstant.book')}}</button>

请帮我解决我的问题,因为我的网站无法使用,非常感谢 :)

【问题讨论】:

  • 你能检查文件夹是否区分大小写是“常量”还是“常量”
  • &lt;button&gt;{{config('Constants.textConstant.book')}}&lt;/button&gt; 替换为 &lt;button&gt;{{config('constant.textConstant.book')}}&lt;/button&gt;,因为您的目录名称是 Constant 并且您在代码中使用 Constants 作为目录名称
  • 它在你的本地机器上工作吗??

标签: laravel laravel-5.2 config constants


【解决方案1】:

如果您启用了缓存,请尝试通过命令行运行以下代码。

php artisan config:clear
php artisan config:cache.

【讨论】:

    【解决方案2】:

    在 CMD 中; 先写

    php artisan config:clear
    

    然后

    php artisan config:cache
    

    希望这会奏效。

    【讨论】:

      猜你喜欢
      • 2016-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-25
      • 2016-09-26
      • 2016-08-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多