Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.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 拉威尔控制器赢得';t将参数传递给服务_Php_Laravel_Function_Parameters - Fatal编程技术网

Php 拉威尔控制器赢得';t将参数传递给服务

Php 拉威尔控制器赢得';t将参数传递给服务,php,laravel,function,parameters,Php,Laravel,Function,Parameters,所以我创建了这个输入视图,它输入一些数据,然后是一些服务来处理数据,这些服务是从控制器调用的,问题是当我试图调用这个特定函数时,SUPMPFunc($index,$loop,$length)控制器似乎没有将参数传递给服务 这是获取的参数太少错误: 控制器: <?php class supmpController extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

所以我创建了这个输入视图,它输入一些数据,然后是一些服务来处理数据,这些服务是从控制器调用的,问题是当我试图调用这个特定函数时,
SUPMPFunc($index,$loop,$length)
控制器似乎没有将参数传递给服务

这是获取的参数太少错误:

控制器:

<?php

class supmpController extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function Store(Request $request)
    {

        $medInput = new MedInput();
        $deviceId = $medInput->MedInput();
        $toolsInput = new ToolsInput();
        $toolsRes = $toolsInput->ToolsInput(request("toolsIndex"));
        $toolsfunctionInput = new ToolsFunctionInput();
        $functionality = $toolsfunctionInput->ToolsFunctionInput(request("checkIndex"));
        $temperature = new TempFunc();
        $humidity = new HumidFUnc();
        $condition = array(
            $temperature->TempFunc(),
            $humidity->HumidFUnc(),
        );
        $electricity = new Electricityinput();
        $elInput = $electricity->ElectricityInput(request("electricIndex"));

        $index = request("tablesupmpindex");
        $loop = request("loopVal");
        $length = request("supmpLength");
        $SUPMP = new SUPMPFunc();
        $result = $SUPMP->SUPMPFunc($index, $loop, $length);
        $analysis = new AnalysisFunc();
        $texttoShow = $analysis->AnalysisFunc();

        $data = array (
            array($deviceId, $texttoShow, $toolsRes, request("loopVal")), //0
            $condition, //1
            $functionality,//2
            $elInput, //3
            $result[0], //4
            $result[1], //5
            $result[2], //6
            $result[3], //7
            $result[4], //8 
            $result[5], //9
            $result[6], //10
        );


        return view('laporan', ['data' => $data]);

    }

}


您需要在构造函数中添加参数:

$index = request("tablesupmpindex");
        $loop = request("loopVal");
        $length = request("supmpLength");
        $SUPMP = new SUPMPFunc($index, $loop, $length); <--edit
$index=request(“tablesupmpindex”);
$loop=请求(“loopVal”);
$length=请求(“supmpLength”);

$SUPMP=新的SUPMPFunc($index、$loop、$length);哪里是
AnalysisFunc
,根据错误消息,错误来自哪里?不是控制器引起的问题,its
AnalysisFunc
class@JitheshJose这不是错误所说的问题是参数太少,对吗?检查传递的变量是否有值。@JitheshJose至少根据错误消息所说的:)它也没有说错误来自此处显示的任何文件
$index = request("tablesupmpindex");
        $loop = request("loopVal");
        $length = request("supmpLength");
        $SUPMP = new SUPMPFunc($index, $loop, $length); <--edit