即时通讯出现此错误:传递给Bitrix24 \ Bitrix24 :: setApplicationScope()的参数1必须为数组类型,给定为int,

时间:2019-07-01 16:44:28

标签: php bitrix

  

传递给Bitrix24 \ Bitrix24 :: setApplicationScope()的参数1必须为int类型的数组,在第23行的C:\ xampp \ htdocs \ cake-project \ src \ Controller \ ConectaApiController.php中调用

第23行-$obB24App->setApplicationScope($arParams['B24_APPLICATION_SCOPE']);

public function index(){

    $arParams = [];

    $log = new Logger('bitrix24');
    $log->pushHandler(new StreamHandler('Conecta.log', Logger::DEBUG));

    $obB24App = new \Bitrix24\Bitrix24(false, $log);
    $obB24App->setApplicationScope($arParams['B24_APPLICATION_SCOPE']);
    $obB24App->setApplicationId($arParams['B24_APPLICATION_ID']);
    $obB24App->setApplicationSecret($arParams['B24_APPLICATION_SECRET']);

    // set user-specific settings
    $obB24App->setDomain($arParams['DOMAIN']);
    $obB24App->setMemberId($arParams['MEMBER_ID']);
    $obB24App->setAccessToken($arParams['AUTH_ID']);
    $obB24App->setRefreshToken($arParams['REFRESH_ID']);

    // get information about current user from bitrix24
    $obB24User = new \Bitrix24\User\User($obB24App);
    $arCurrentB24User = $obB24User->current();

函数是这样的:

public function setApplicationScope(array $applicationScope){

    if (is_array($applicationScope) && count($applicationScope) > 0) {
         $this->applicationScope = $applicationScope;
         return true;

    } else {
         throw new Bitrix24Exception('application scope not set');
    } 
}

0 个答案:

没有答案