代码拉取完成,页面将自动刷新
<?php
class AligenieIAP
{
public $utterance = "";
public $request_city = "";
public $skill_name = "";
public $intent_name = "";
public $slot_location = "";
public $slot_date = "";
function __construct($post_data) {
$json_obj = json_decode($post_data, true);
$this->utterance = $json_obj['utterance'];
$this->skill_name = $json_obj['skillName'];
$this->intent_name = $json_obj['intentName'];
$this->request_city = @$json_obj['requestData']['city'];
$slots = @$json_obj['slotEntities'];
if (!empty($slots)) {
foreach ($slots as $slot) {
$intentParameterName = $slot['intentParameterName'];
if ($this->startsWith($intentParameterName, "sys.location")) {
$this->slot_location = $slot['slotValue'];
} else if ($this->startsWith($intentParameterName, "sys.date")) {
$this->slot_date = json_decode($slot['slotValue'], true)['iDateString'];
}
}
}
}
public function toString() {
return "Aligenie IAP request object:\n" .
"\tutterance: $this->utterance\n" .
"\trequest_city: $this->request_city\n" .
"\tskill_name: $this->skill_name\n" .
"\tintent_name: $this->intent_name\n" .
"\tslot_location: $this->slot_location\n" .
"\tslot_date: $this->slot_date\n";
}
private function startsWith($haystack, $needle) {
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
}
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。