dongxianrang9269 2017-04-11 00:16
浏览 31
已采纳

PHP / Asterisk AGI计算GetData的位数

I am attempting to count the number of digits that a caller inputs when prompted. If the number of digits input does not equal 10, I would like it to return to the beginning of the file. If the number of digits input does equal 10 I would like it to continue executing the program. With the code below, no matter the callers input, it always goes back to the beginning. Can anyone give me some insight here?

begining: {

    $agi->stream_file('file1');
    $result = $agi->get_data('beep', 6000, 10);
    $numlength = mb_strlen(utf8_decode($result));
    if ($numlength < 10){
            goto begining;
    }

    else {
        $number= $result['result'];
        $agi->verbose("Number: ".$number);
    }
}
  • 写回答

1条回答 默认 最新

  • doumaqing6652 2017-04-11 03:17
    关注

    You need to specify which part of the array you are counting. Add ['result'] to your $result variable.

    $agi->stream_file('file1');
    $result = $agi->get_data('beep', 6000, 10);
    $numlength = mb_strlen(utf8_decode($result['result']));
       if ($numlength < 10){
               goto begining;
       }
    
       else {
           $number= $result['result'];
           $agi->verbose("Number: ".$number);
       }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分