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


PHP xml::xmlstrtoarr方法代码示例

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


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

示例1: executeAction

 public function executeAction($params)
 {
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         $responsestr = $eslCon->sendRecv('api show channels as xml')->getBody();
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</span>';
             exit;
         } else {
             throw $e;
         }
     }
     if (trim($responsestr) == '0 total.' || trim($responsestr) == '+OK' || trim($responsestr) == '<result row_count="0"/>') {
         return array();
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     $channelStatus = xml::xmlstrtoarr($responsestr);
     if (count($channelStatus) == 0) {
         return $channelStatus;
     } else {
         if (isset($channelStatus['row']['uuid'])) {
             return array($channelStatus['row']);
         } else {
             return $channelStatus['row'];
         }
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:30,代码来源:cmgetchannellist.php

示例2: buildcdrarray

 public static function buildcdrarray($cdrxml)
 {
     try {
         $xmlarr = xml::xmlstrtoarr($cdrxml);
     } catch (Exception $e) {
         Kohana::log('error', $e->getMessage());
         return;
     }
     return arr::flatten($xmlarr);
 }
开发者ID:swk,项目名称:bluebox,代码行数:10,代码来源:XmlcdrManager.php

示例3: executeAction

 public function executeAction($params)
 {
     $this->checkRequiredParams('executeAction', $params);
     $this->assignEmptyParams($params, 2, array(null, false));
     list($uuid, $details) = $params;
     $eslCon = freeswitch_callmanager_Driver::getESL();
     try {
         if (!$details) {
             $responsestr = $eslCon->sendRecv('api show channels like ' . $uuid . ' as xml')->getBody();
         } else {
             $responsestr = $eslCon->sendRecv('api uuid_dump ' . $uuid . ' xml')->getBody();
         }
     } catch (ESLException $e) {
         if (strpos($e->getMessage(), 'Not connected')) {
             echo '<div class="error">Unable to connect to the switch console.  This usually means that mod_event_socket is not running, or that the password that you entered during the setup process has changed. The error message was:<br>' . $e->getMessage() . '</div>';
             exit;
         } else {
             throw $e;
         }
     }
     if (trim($responsestr) == '0 total.' || trim($responsestr) == '+OK' || trim($responsestr) == '<result row_count="0"/>') {
         return array();
     }
     if (substr(trim($responsestr), 0, 4) == '-ERR') {
         $this->_throwError($responsestr);
     }
     $xmlarr = xml::xmlstrtoarr($responsestr);
     if (!$xmlarr || count($xmlarr) == 0) {
         return array();
     } else {
         if (!$details) {
             if (isset($xmlarr['row']['uuid'])) {
                 return array($xmlarr['row']);
             } else {
                 return $xmlarr['row'];
             }
         } else {
             return $xmlarr['headers'];
         }
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:41,代码来源:cmgetchannelinfo.php


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