我正在尝试集成textlocal sms api,如果我在加载库的时候传递了三个,那么它就不能工作。
错误:函数Textlocal::__construct()的参数太少,已传递%1,需要至少%2
我有一个Setupfile.php库,如下所示。
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Setupfile {
function send($number, $message)
{
$ci = & get_instance();
$data=array("username"=>'xyz',"hash"=>'abc','apiKey'=>false);
$sender = "xyz";
$numbers = array($number);
$ci->load->library('textlocal', $data); //passing paramenters
}
}和其他Textlocal.php库,如下所示:
class Textlocal
{
function __construct($username, $hash, $apiKey = false) //get into this function
{
$this->username = $username;
$this->hash = $hash;
if ($apiKey) {
$this->apiKey = $apiKey;
}
}
}发布于 2021-06-29 12:03:42
基本上,我在函数中传入了and数组,并尝试将作为变量获取。现在,我已经通过获取一个array()解决了这个问题
https://stackoverflow.com/questions/68095759
复制相似问题