config() 读取不到 config/plugin/overtrue/wechat.php

chenliangwei

问题描述

webman2.1+php8.4
config 函数 读取不到 config/plugin/overtrue/wechat.php 文件的配置
是我缺少什么配置吗?

$config = config('plugin.overtrue.wechat.open_platform', []);
print_r($config);//结果是空数组

//config/plugin/overtrue/wechat.php  文件内容如下:
<?php

return [
    // 微信开放平台配置(网站应用)
    'open_platform' => [
        'app_id' => env('WECHAT_OPEN_APPID', ''),
        'secret' => env('WECHAT_OPEN_SECRET', ''),
        'redirect_uri' => env('WECHAT_REDIRECT_URI', ''),
        'scopes' => ['snsapi_login'], // 网页授权登录
    ],

    // 回调路由配置
    'routes' => [
        'wechat_callback' => '',
        'wechat_qrcode' => '',
        'wechat_check' => '',
    ],

    // 其他配置
    'state_expire' => 300, // state有效期(秒)
    'qrcode_expire' => 300, // 二维码有效期(秒)
];
100 1 0
1个回答

新建一个
config/plugin/overtrue/app.php

<?php
return [
    'enable' => true,
];

插件目录的配置需要app.enable为true才加载

  • chenliangwei 6天前

    感谢 ,读取到了,那是不是 config/plugin/jzh/ 目录 我也要建个 app.php 了

🔝