丶巡山 2020-10-30 16:06:55 1086次浏览 0条评论 0 1 0

yii2,在web.php文件中,加入了redis Component后,phpstrom使用
Yii::$app->redis->
没有办法显示包含的方法;

<?php
/**
 * Yii app stub file. Autogenerated by yii2-stubs-generator (stubs console command).
 * Used for enhanced IDE code autocompletion.
 * Updated on 2020-04-24T08:10:26+0000
 */
class Yii extends \yii\BaseYii
{
    /**
     * @var BaseApplication|WebApplication|ConsoleApplication the application instance
     */
    public static $app;
}

/**
 * @property app\common\services\Service $service
 * @property yii\queue\redis\Queue $queue
 * @property yii\caching\FileCache $cache
 * @property yii\swiftmailer\Mailer $mailer
 * @property yii\db\Connection $db
 * @property yii\redis\Connection $redis
 * @property yii\elasticsearch\Connection $elasticsearch
 * @property yii\mongodb\Connection $mongodb
 **/
abstract class BaseApplication extends yii\base\Application
{
}

/**
 * @property app\common\services\Service $service
 * @property yii\queue\redis\Queue $queue
 * @property yii\caching\FileCache $cache
 * @property yii\swiftmailer\Mailer $mailer
 * @property yii\db\Connection $db
 * @property yii\redis\Connection $redis
 * @property yii\elasticsearch\Connection $elasticsearch
 * @property yii\mongodb\Connection $mongodb
 **/
class WebApplication extends yii\web\Application
{
}

/**
 * @property app\common\services\Service $service
 * @property yii\queue\redis\Queue $queue
 * @property yii\caching\FileCache $cache
 * @property yii\swiftmailer\Mailer $mailer
 * @property yii\db\Connection $db
 * @property yii\redis\Connection $redis
 * @property yii\elasticsearch\Connection $elasticsearch
 * @property yii\mongodb\Connection $mongodb
 **/
class ConsoleApplication extends yii\console\Application
{
}

可以把这段代码 复制到 Yii.php中,然后把文件放在 vendor目录下,这样就可以显示了;

TIP:\vendor\yiisoft\yii2\Yii.php 最好把这个文件 右键-》mark as plain text 防止phpstrom识别出2个Yii.php

觉得很赞
    没有找到数据。
您需要登录后才可以评论。登录 | 立即注册