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


PHP Result::get方法代码示例

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


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

示例1: get_calendar

 public function get_calendar()
 {
     $date_start = date('Y-m-d', $_GET['start']);
     $date_end = date('Y-m-d', $_GET['end']);
     $variable = new Result();
     $variable->get();
     $day = 24 * 60 * 60 * 1000;
     foreach ($variable as $key => $value) {
         $title = null;
         $color = null;
         switch ($value->result_type_id) {
             case 1:
                 $title = "รายสัปดาห์";
                 $color = "#337AB7";
                 break;
             case 2:
                 $title = "รายเดือน";
                 $color = "#f0AD4E";
                 break;
             default:
                 $title = "รายวัน";
                 $color = "#5cb85c";
                 break;
         }
         $data_[] = array("title" => $value->title, "start" => date("Y-m-d", strtotime($value->import_time)), "url" => "reports/views/" . $value->id, "color" => $color);
     }
     echo json_encode(@$data_);
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:28,代码来源:reports.php

示例2: parse

 /**
  * Tries to parse a string and to get the domain name, tld and idn
  * converted domain name.
  *
  * If given string is not a domain name, it will add a default tld.
  *
  * Also skips given string if it is longer than 63 characters.
  *
  * @throws instance of AbstractException if throwExceptions = true
  * @param  string $unparsedString
  * @param  string $defaultTld
  * @return void
  */
 public function parse($unparsedString, $defaultTld = 'com')
 {
     try {
         if ($this->loaded === false) {
             $this->load();
         }
         $matchedDomain = '';
         $matchedDomainIdn = '';
         $matchedTld = '';
         $matchedTldIdn = '';
         $matchedGroup = '';
         $validHostname = true;
         $IdnaConverter = new Idna(array('idn_version' => 2008));
         preg_match('/^((http|https|ftp|ftps|news|ssh|sftp|gopher):[\\/]{2,})?([^\\/]+)/', mb_strtolower(trim($unparsedString), $this->encoding), $matches);
         $parsedString = $IdnaConverter->encode(end($matches));
         foreach ($this->tldList['content'] as $tldgroup => $tlds) {
             foreach ($tlds as $tld) {
                 if (preg_match('/\\.' . $tld . '$/', $parsedString, $trash)) {
                     $matchedTld = $tld;
                     $matchedTldIdn = $IdnaConverter->encode($tld);
                     $matchedDomain = substr($parsedString, 0, -strlen('.' . $matchedTld));
                     $matchedDomain = rtrim($matchedDomain, '.');
                     $matchedDomain = ltrim($matchedDomain, '.');
                     if ($matchedTld != 'name' && strpos($matchedDomain, '.')) {
                         $matchedDomain = str_replace('.', '', strrchr($matchedDomain, '.'));
                     }
                     if (strpos($matchedDomain, ' ')) {
                         $matchedDomain = explode(' ', $matchedDomain);
                         $matchedDomain = end($matchedDomain);
                     }
                     $matchedDomainIdn = $IdnaConverter->encode($matchedDomain);
                     $matchedGroup = $tldgroup;
                     break;
                 }
                 if ($tld == $parsedString) {
                     $matchedTld = $tld;
                     $matchedTldIdn = $IdnaConverter->encode($tld);
                     break;
                 }
             }
         }
         if ($matchedDomain == '' && strlen($matchedDomainIdn) <= 63 && $matchedTld == '') {
             $matchedDomain = $IdnaConverter->decode(preg_replace_callback('/[^a-zA-Z0-9\\-\\.]/', function ($match) use(&$validHostname) {
                 $validHostname = false;
             }, $IdnaConverter->encode($parsedString)));
             $matchedDomainIdn = $IdnaConverter->encode($matchedDomain);
             $matchedTld = $matchedTldIdn = $defaultTld;
         } elseif ($matchedDomain != '' && strlen($matchedDomainIdn) <= 63 && $matchedTld != '') {
             $matchedDomain = $IdnaConverter->decode(preg_replace_callback('/[^a-zA-Z0-9\\-\\.]/', function ($match) use(&$validHostname) {
                 $validHostname = false;
             }, $IdnaConverter->encode($matchedDomain)));
             $matchedDomainIdn = $IdnaConverter->encode($matchedDomain);
         } elseif ($matchedDomain == '' && $matchedTld != '') {
             $validHostname = false;
         } else {
             throw \Novutec\DomainParser\AbstractException::factory('UnparsableString', 'Unparsable domain name.');
         }
         $Result = new Result($matchedDomain, $matchedDomainIdn, $IdnaConverter->decode($matchedTld), $matchedTldIdn, $matchedGroup, $validHostname);
     } catch (\Novutec\DomainParser\AbstractException $e) {
         if ($this->throwExceptions) {
             throw $e;
         }
         $Result = new Result();
         $Result->error = $e->getMessage();
     }
     return $Result->get($this->format);
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:80,代码来源:Parser.php


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