Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 不应静态调用非静态方法App\Console\Setting::KS()-Laravel_Php_Laravel_Eloquent - Fatal编程技术网

Php 不应静态调用非静态方法App\Console\Setting::KS()-Laravel

Php 不应静态调用非静态方法App\Console\Setting::KS()-Laravel,php,laravel,eloquent,Php,Laravel,Eloquent,我有自己的课 <?php namespace App\Çonsole; use App\KernelSetting; class Setting { /** * @param $setting * @return */ function KS($setting) { return KernelSetting::where('setting', $setting)->first()->value;

我有自己的课

<?php

namespace App\Çonsole;

use App\KernelSetting;

class Setting
{

    /**
     * @param $setting
     * @return
     */
    function KS($setting)
    {
        return KernelSetting::where('setting', $setting)->first()->value;
    }
}


错误消息非常清楚,您需要将该方法设置为静态,以便像这样调用它

static function KS($setting)
{
    return KernelSetting::where('setting', $setting)->first()->value;
}
您可以在此处阅读有关静态的更多信息:

static function KS($setting)
{
    return KernelSetting::where('setting', $setting)->first()->value;
}