当前位置: 首页>>代码示例>>PHP>>正文


PHP AppletInstance::assocKeyValueCombine方法代码示例

本文整理汇总了PHP中AppletInstance::assocKeyValueCombine方法的典型用法代码示例。如果您正苦于以下问题:PHP AppletInstance::assocKeyValueCombine方法的具体用法?PHP AppletInstance::assocKeyValueCombine怎么用?PHP AppletInstance::assocKeyValueCombine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppletInstance的用法示例。


在下文中一共展示了AppletInstance::assocKeyValueCombine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Response

<?php

$response = new Response();
/* Fetch all the data to operate the menu */
$digits = isset($_REQUEST['Digits']) ? $_REQUEST['Digits'] : false;
$prompt = AppletInstance::getAudioSpeechPickerValue('prompt');
$invalid_option = AppletInstance::getAudioSpeechPickerValue('invalid-option');
$repeat_count = AppletInstance::getValue('repeat-count', 3);
$next = AppletInstance::getDropZoneUrl('next');
$selected_item = false;
/* Build Menu Items */
$choices = (array) AppletInstance::getDropZoneUrl('choices[]');
$keys = (array) AppletInstance::getDropZoneValue('keys[]');
$menu_items = AppletInstance::assocKeyValueCombine($keys, $choices);
$numDigits = 1;
foreach ($keys as $key) {
    if (strlen($key) > $numDigits) {
        $numDigits = strlen($key);
    }
}
if ($digits !== false) {
    if (!empty($menu_items[$digits])) {
        $selected_item = $menu_items[$digits];
    } else {
        if ($invalid_option) {
            $verb = AudioSpeechPickerWidget::getVerbForValue($invalid_option, null);
            $response->append($verb);
            $response->addRedirect();
        } else {
            $response->addSay('You selected an incorrect option.');
            $response->addRedirect();
开发者ID:JeffaCubed,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php

示例2: get_instance

<?php

$ci =& get_instance();
/* Get the body of the SMS message */
$body = isset($_REQUEST['Body']) ? trim($ci->input->get_post('Body')) : null;
$body = strtolower($body);
$prompt = AppletInstance::getValue('prompt');
$keys = AppletInstance::getValue('keys[]');
$responses = AppletInstance::getValue('responses[]');
$menu_items = AppletInstance::assocKeyValueCombine($keys, $responses, 'strtolower');
$response = new TwimlResponse();
/* Display the menu item if we found a match - case insensitive */
if (array_key_exists($body, $menu_items) && !empty($menu_items[$body])) {
    $response_text = $menu_items[$body];
} else {
    /* Display the prompt if incorrect */
    $response_text = $prompt;
}
$response->sms($response_text);
$response->Respond();
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:20,代码来源:twiml.php

示例3: isset

<?php

$body = isset($_REQUEST['Body']) ? trim($_REQUEST['Body']) : null;
$keys = (array) AppletInstance::getValue('keys[]');
$responses = (array) AppletInstance::getDropZoneUrl('responses[]');
$menu_items = AppletInstance::assocKeyValueCombine($keys, $responses);
$next = AppletInstance::getDropZoneUrl('invalid-option');
$response = new TwimlResponse();
foreach ($menu_items as $regex => $redirect) {
    if (!empty($regex) && preg_match("/" . $regex . "/i", $body)) {
        $next = $redirect;
        break;
    }
}
if (!empty($next)) {
    $response->redirect($next);
}
$response->respond();
开发者ID:mymizan,项目名称:OpenVBX-Plugin-Match,代码行数:18,代码来源:twiml.php


注:本文中的AppletInstance::assocKeyValueCombine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。