當前位置: 首頁>>代碼示例>>PHP>>正文


PHP strings::strlen方法代碼示例

本文整理匯總了PHP中strings::strlen方法的典型用法代碼示例。如果您正苦於以下問題:PHP strings::strlen方法的具體用法?PHP strings::strlen怎麽用?PHP strings::strlen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在strings的用法示例。


在下文中一共展示了strings::strlen方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 function run()
 {
     $q = $this->get_param('query');
     if (empty($q)) {
         $q = functions::request_var('keyword');
     }
     if (loader::in_ajax()) {
         $keyword = trim($q);
     } else {
         $keyword = trim(urldecode($q));
     }
     $this->renderer->set_return('keyword', $keyword);
     $this->renderer->set_main_title('search');
     if (empty($q)) {
         return;
     }
     if (strings::strlen($keyword) < 3) {
         $this->renderer->set_message('sat.search_too_short', array('result' => false));
         $this->renderer->set_ajax_message('sat.search_too_short');
         return false;
     }
     // make search and redirect to it
     $id = $this->make_search($keyword);
     // redirect to search results
     $url = $this->_controller->get_context()->get_router()->make_url('/search/' . $id . '/');
     if (loader::in_ajax()) {
         $this->_controller->set_null_template();
         $this->renderer->set_ajax_message($this->_found ? sprintf('По вашему запросу найдено %d записей', $this->_found) : 'Подходящих записей не найдено')->set_ajax_result($this->_found)->set_ajax_redirect($url);
     } else {
         functions::redirect($url);
         core::get_instance()->halt();
     }
 }
開發者ID:egregor-dev,項目名稱:SatCMS,代碼行數:33,代碼來源:query.php

示例2: run

 function run()
 {
     $q = trim(urldecode($this->request->get('q')));
     $q = core::lib('db')->escape($q);
     if (strings::strlen($q) < 2) {
         $this->renderer->set_ajax_result(false)->set_ajax_message('Короткое сообщение')->ajax_flush(false);
         return;
     }
     $pmod = $this->_controller->get_context();
     $ph = $pmod->get_search_handle()->set_working_fields('keyword')->set_limit(10);
     if (!empty($q)) {
         $ph->set_where("keyword like '%{$q}%' AND c_count > 0");
     }
     $sugg = $ph->load()->render();
     core::get_instance()->ajax_answer($sugg);
 }
開發者ID:egregor-dev,項目名稱:SatCMS,代碼行數:16,代碼來源:suggest.php

示例3: _is_route_matched

 /**
  * Check route matched to uri
  * Extract params (only for regex <?Pname> routes)
  */
 private function _is_route_matched($route, &$params)
 {
     $match = isset($route['match']) ? $route['match'] : false;
     $uri = $this->_uri;
     // wildcard: /url/blabla/*
     if ($match) {
         if ($match == '*') {
             $match = '';
             $uri = '';
         } else {
             if (strings::strpos($match, '*') !== false) {
                 $match = strings::substr($match, 0, strings::strpos($match, '*'));
                 $uri = strings::substr($uri, 0, strings::strlen($match));
             }
         }
     }
     return isset($route['regex']) && preg_match($route['regex'], $this->_uri, $params) && array_shift($params) || $match !== false && $uri == $match;
 }
開發者ID:egregor-dev,項目名稱:SatCMS,代碼行數:22,代碼來源:module_router.php


注:本文中的strings::strlen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。