Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.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 错误:遇到未捕获的异常_Php_Codeigniter - Fatal编程技术网

Php 错误:遇到未捕获的异常

Php 错误:遇到未捕获的异常,php,codeigniter,Php,Codeigniter,我收到这个错误: 遇到未捕获的异常类型:ArgumentCountError 消息:参数太少,无法正常工作 Home::cadastroOrcamentoCliente(),传入了0 C:\xampp\htdocs\sistema\u financas\u old\system\core\CodeIgniter.php on 第532行和第6行 文件名: C:\xampp\htdocs\sistema\u financas\u old\application\controllers\Home.p

我收到这个错误:

遇到未捕获的异常类型:ArgumentCountError

消息:参数太少,无法正常工作 Home::cadastroOrcamentoCliente(),传入了0 C:\xampp\htdocs\sistema\u financas\u old\system\core\CodeIgniter.php on 第532行和第6行

文件名: C:\xampp\htdocs\sistema\u financas\u old\application\controllers\Home.php

电话号码:1116

回溯:

文件:C:\xampp\htdocs\sistema\u financas\u old\index.php行:315 功能:需要一次

这是我的代码:

//Inicio de desenvolvimento new window client.
    //New Página para gerar pedido de cliente.
    function cadastroOrcamentoCliente($cpfcnpj=null, $tipo_pessoa=null, $dados = null, $id_pf, $id_cliente, $id_cadastro) {
        $tipo_login = $this->session->userdata('tipo_login');
        if ($tipo_login == '1' || $tipo_login == '4' || $tipo_login == '5') {
            $dadosPessoa['tipo_pessoa'] = null;
            $dadosOrcamento['str'] = $this->load->view('admin/compras/popup_cadastro', $dadosPessoa, true);
            if ($tipo_pessoa == 1) {
                $dadosOrcamento['cpf'] = $cpfcnpj;
                $dadosOrcamento['cnpj'] = null; 
            } else if ($tipo_pessoa == 2) {
                $dadosOrcamento['cpf'] = null;
                $dadosOrcamento['cnpj'] = $cpfcnpj;
            } else {
                $dadosOrcamento['cpf'] = $cpfcnpj;
                $dadosOrcamento['cnpj'] = $cpfcnpj; 
            }

            if ($this->alteracao->editEndereco($id_cadastro) && $this->alteracao->editPessoaFisica($id_pf) &&
                $this->alteracao->editCliente($id_cliente) && $this->alteracao->editCadastroComum($id_cadastro) && $this->alteracao->editarDadosBancarios($id_cadastro)) {
            $data_cad = date("d/m/Y");
            $hora_cad = date("H:i:s");
            $this->alteracao->cadastroHistorico('Dados do cliente editados', $id_cadastro, $data_cad, $hora_cad);
            $this->alteracao->mensagemAlerta("Dados alterados com sucesso!", 1, "home/cadastros", $id_cadastro);

            $dadosOrcamento['orcamento'] = $this->compras_m->buscarOrcamentoAtual($this->session->userdata('id_orcamento'));
            $this->load->view('admin/head');
            $dadosBarra['dadosB'] = $this->financeiro->listaContas();
            $this->load->view('admin/barraSuperior', $dadosBarra);
            $dadosLogo['logo'] = $this->adm->retornaLogo();
            $this->load->view('admin/menu', $dadosLogo);
            $this->load->view('admin/vendas/cadastro_orcamento_cliente', $dadosOrcamento);
            $this->load->view('admin/footer');
        } else {
            $dados['mensagem'] = null;
            $this->paginas($dados);
        }
    }
    }
我打电话来

 <form method="post" action="<?php echo site_url('pedido/cadastroOrcamentoVendaCliente') ?>">
这是:

这从根本上说是错误的

:

请注意,当使用默认参数时,任何默认值都应该位于任何非默认参数的右侧;否则,事情就不会像预期的那样发生

您需要在此处更改参数的顺序-没有默认值的参数需要放在第一位,只有后面有默认值的参数:

function cadastroOrcamentoCliente($id_pf, $id_cliente, $id_cadastro, $cpfcnpj=null,
                                  $tipo_pessoa=null, $dados = null)
然后,在实际调用该函数时,您仍然必须至少为前三个函数提供值。

这是:

这从根本上说是错误的

:

请注意,当使用默认参数时,任何默认值都应该位于任何非默认参数的右侧;否则,事情就不会像预期的那样发生

您需要在此处更改参数的顺序-没有默认值的参数需要放在第一位,只有后面有默认值的参数:

function cadastroOrcamentoCliente($id_pf, $id_cliente, $id_cadastro, $cpfcnpj=null,
                                  $tipo_pessoa=null, $dados = null)

然后,您仍然必须在实际调用该函数时至少为前三个字段提供值。

如果您将字段过帐到
cadastroorcmentoclient
中,则不应定义参数计数
POST
字段不被视为函数参数,这就是为什么会出现错误(您声明函数必须准确地接收6个参数,但没有得到任何参数)


只需将函数声明为
function cadastoracementoclient()
,然后通过
$this->input->post('fieldname')
(在使用表单验证帮助程序验证所有内容之后)

将字段发布到
cadastoracementoclient
就不应该定义参数计数
POST
字段不被视为函数参数,这就是为什么会出现错误(您声明函数必须准确地接收6个参数,但没有得到任何参数)


只需将函数声明为
function cadastoracementoclient()
,然后通过
$this->input->post('fieldname')
(在使用表单验证帮助程序验证所有内容之后)处理post'ed字段

演示如何调用
cadastoracementoclient()
只需创建一个新屏幕并需要添加到项目中您还没有显示对该函数的调用演示如何调用
cadastroorcmentoclient()
只需创建一个新屏幕并需要添加到项目中您还没有显示对该函数的调用