Laravel沙发\口才

时间:2018-01-18 17:33:40

标签: php laravel

晚上好,我写是因为我有以下问题: 我声明我已经安装了沙发\ eloquence包但似乎它还没有安装,我仍然有这个错误:

在ProviderRepository.php第208行:

Class' Sofa \ Eloquence \ ServiceProvider'找不到

脚本@php artisan包:发现处理返回的自动加载转储事件,错误代码为1



This is my Composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=7.0.0",
        "barryvdh/laravel-cors": "^0.11.0",
        "barryvdh/laravel-dompdf": "^0.8.1",
        "fideloper/proxy": "~3.3",
        "gloudemans/shoppingcart": "^2.4",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0",
        "sofa/eloquence": "^5.5"
    },
    "require-dev": {
        "filp/whoops": "~2.0",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "~1.0",
        "phpunit/phpunit": "~6.0",
        "symfony/thanks": "^1.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}




2 个答案:

答案 0 :(得分:1)

很有可能在POJO的“ providers”数组中列出了Sofa\Eloquence\ServiceProvider::class,但是没有提供此类的config/app.php版本。

在Laravel 5.5中,由于5.5具有内置的自动发现功能,因此不再需要添加服务提供商。因此作曲家很可能正在安装不再包含此服务提供者类的5.5合适的sofa/eloquence软件包。通过从sofa/eloquence中删除此引用,它应该更有可能解决此问题。

答案 1 :(得分:0)

尝试

int countOccurrences(int n, int num)
{
    int i,k;

    i=0;
    while(num!=0)
    {

        k=num%10;
        num=num/10;
        if(k==n)
        {
            i++;
        }
    }
}

// Main
void main()
{
    int num= 1222345;
    int n = 2;
    printf("Occurance of a number: %d", countOccurrences(n,num));
}