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


PHP Result::getValue方法代码示例

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


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

示例1: app_choice

function app_choice()
{
    // Accessing the result object
    $result = new Result();
    $choice = $result->getValue();
    // Create a new instance of the Tropo object.
    $tropo = new Tropo();
    // Provide a prompt based on the value
    if ($choice == "1") {
        $tropo->say("You picked Lord of the Rings.  Did you know Gandalf is also Mag knee toe?  Weird.");
    }
    if ($choice == "2") {
        $tropo->say("You picked the original Star Wars.  I hear Leonard Nimoy was awe some in those.");
    }
    if ($choice == "3") {
        $tropo->say("You picked the Star Wars prequels.  Stop calling this number, Mr. Lucas, we know it's you.");
    }
    if ($choice == "4") {
        $tropo->say("You picked the Matrix. Dude, woe.");
    }
    // Tell Tropo what to do next. This redirects to the instructions under dispatch_post('/hangup', 'app_hangup').
    $tropo->on(array("event" => "continue", "next" => "favorite-movie-webapi.php?uri=hangup"));
    // Tell Tropo what to do if there's an problem, like a timeout. This redirects to the instructions under dispatch_post('/incomplete', 'app_incomplete').
    $tropo->on(array("event" => "incomplete", "next" => "favorite-movie-webapi.php?uri=incomplete"));
    // Render the JSON for the Tropo WebAPI to consume.
    return $tropo->RenderJson();
}
开发者ID:MeiTen,项目名称:tropo-webapi-php,代码行数:27,代码来源:favorite-movie-webapi.php

示例2: voice_continue

 public function voice_continue()
 {
     $this->set_output_mode(MY_Controller::OUTPUT_NORMAL);
     $tropo = new Tropo();
     @($result = new Result());
     $answer = $result->getValue();
     $tropo->say("You said " . $answer);
     $tropo->RenderJson();
 }
开发者ID:anupkelkar02,项目名称:FSM,代码行数:9,代码来源:tropo_api.php

示例3: zip_end

function zip_end()
{
    // Create a new instance of the result object and get the value of the user input.
    $result = new Result();
    $zip = $result->getValue();
    // Create a new instance of the Tropo object.
    $tropo = new Tropo();
    // Get the weather information for the entered zip code.
    formatWeatherResponse($tropo, $zip);
    // Render the JSON for the Tropo WebAPI to consume.
    return $tropo->RenderJson();
}
开发者ID:smartfoundry,项目名称:smartfoundry-webapi-php,代码行数:12,代码来源:get_zip_code.php

示例4: conference

function conference()
{
    global $voice;
    $tropo = new Tropo();
    $tropo->setVoice($voice);
    $result = new Result();
    $conference = $result->getValue();
    $tropo->say('<speak>Conference ID <say-as interpret-as=\'vxml:digits\'>' . $conference . '</say-as> accepted.</speak>');
    $tropo->say('You will now be placed into the conference. Please announce yourself. To exit the conference without disconnecting, press pound.');
    $tropo->conference($conference, array('id' => $conference, 'terminator' => '#'));
    $tropo->say('You have left the conference.');
    $tropo->on(array("event" => "continue", "next" => "restart"));
    $tropo->RenderJson();
}
开发者ID:smartfoundry,项目名称:smartfoundry-webapi-php,代码行数:14,代码来源:conference.php

示例5: demo_end

function demo_end()
{
    $result = new Result();
    $zip = $result->getValue();
    $weather_info = getWeather($zip);
    $city = array_pop($weather_info);
    $tropo = new Tropo();
    $tropo->say("The current weather for {$city} is...");
    foreach ($weather_info as $info) {
        $tropo->say("{$info}.");
    }
    $tropo->say("Thank you for calling. Goodbye.");
    $tropo->hangup();
    return $tropo->RenderJson();
}
开发者ID:akalsey,项目名称:TropoPHP,代码行数:15,代码来源:WeatherDemo.php

示例6: cleangrammar

            // Build a grammar with the venue ID as the concept and the name and
            // dtmf tone as options. Strip certain characters from venue names that
            // might cause the grammar engine to choke
            $choices .= "{$venue['id']} (" . cleangrammar($venue['name']) . ", {$dtmf}), ";
            $dtmf++;
        }
    }
    // We allow the caller to say the name of the venue with voice recognition or to press
    // or say the number of the venue.
    $tropo->say('Speak the name of the venue or press it\'s number.');
    $tropo->ask($say, array('choices' => $choices, 'required' => true, 'attempts' => 3, 'timeout' => 30, 'bargein' => true));
}
if ($action == 'checkin') {
    // This is the result of the question being answered
    $result = new Result();
    $vid = $result->getValue();
    if ($vid) {
        // If we have a value back, it's because the input matched.
        // So take that venue ID and check in here.
        $checkin = getapi('checkin', array('vid' => $vid), 1, 'POST');
        // We're going to speak the foursquare result message to them
        $message = $checkin['checkin']['message'];
        // Is there a new Mayor? if so, let them know!
        if ($checkin['checkin']['mayor']['type'] != 'nochange') {
            $message .= ' ' . $checkin['checkin']['mayor']['message'];
        }
        $tropo->say($message);
    } else {
        // No value came back, so there was no match. Let the user know we
        // can't help.
        // An interesting enhancement here would be to look for a lack of matches
开发者ID:rogervaas,项目名称:tropo-samples,代码行数:31,代码来源:4square.php


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