• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP setlocale函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中setlocale函数的典型用法代码示例。如果您正苦于以下问题:PHP setlocale函数的具体用法?PHP setlocale怎么用?PHP setlocale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: run

 public static function run()
 {
     spl_autoload_register(['Bootstrap', 'autoload']);
     putenv('LANG=en_US.UTF-8');
     setlocale(LC_CTYPE, 'en_US.UTF-8');
     date_default_timezone_set(@date_default_timezone_get());
     session_start();
     $session = new Session($_SESSION);
     $request = new Request($_REQUEST);
     $setup = new Setup($request->query_boolean('refresh', false));
     $context = new Context($session, $request, $setup);
     if ($context->is_api_request()) {
         (new Api($context))->apply();
     } else {
         if ($context->is_info_request()) {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             require __DIR__ . '/pages/info.php';
         } else {
             $public_href = $setup->get('PUBLIC_HREF');
             $x_head_tags = $context->get_x_head_html();
             $fallback_html = (new Fallback($context))->get_html();
             require __DIR__ . '/pages/index.php';
         }
     }
 }
开发者ID:arter97,项目名称:h5ai,代码行数:26,代码来源:class-bootstrap.php


示例2: __construct

 /**
  * Constructor
  *
  * @return  void
  */
 public function __construct($caller)
 {
     setlocale(LC_MONETARY, 'en_US.UTF-8');
     $logPath = Config::get('log_path', PATH_APP . DS . 'logs');
     $this->logFile = $logPath . DS . 'cart.log';
     $this->caller = $caller;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:12,代码来源:CartMessenger.php


示例3: translate

function translate($lang, $test = 0)
{
    global $LOCALE_PATH;
    putenv("LANGUAGE={$lang}");
    bindtextdomain("zarafa", "{$LOCALE_PATH}");
    if (STORE_SUPPORTS_UNICODE == false) {
        bind_textdomain_codeset('zarafa', "windows-1252");
    } else {
        bind_textdomain_codeset('zarafa', "utf-8");
    }
    textdomain('zarafa');
    setlocale(LC_ALL, $lang);
    $trans_array["Sent Items"] = _("Sent Items");
    $trans_array["Outbox"] = _("Outbox");
    $trans_array["Deleted Items"] = _("Deleted Items");
    $trans_array["Inbox"] = _("Inbox");
    $trans_array["Calendar"] = _("Calendar");
    $trans_array["Contacts"] = _("Contacts");
    $trans_array["Drafts"] = _("Drafts");
    $trans_array["Journal"] = _("Journal");
    $trans_array["Notes"] = _("Notes");
    $trans_array["Tasks"] = _("Tasks");
    $trans_array["Junk E-mail"] = _("Junk E-mail");
    return $trans_array;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:25,代码来源:exec.zarafa7.foldersnames.php


示例4: _fetch_fireeagle_positions

 private function _fetch_fireeagle_positions($fireeagle_access_key, $fireeagle_access_secret)
 {
     $position = array();
     require_once MIDCOM_ROOT . '/external/fireeagle.php';
     $fireeagle = new FireEagle($this->_config->get('fireeagle_consumer_key'), $this->_config->get('fireeagle_consumer_secret'), $fireeagle_access_key, $fireeagle_access_secret);
     // Note: this must be C so we get floats correctly from JSON. See http://bugs.php.net/bug.php?id=41403
     setlocale(LC_NUMERIC, 'C');
     $user_data = $fireeagle->user();
     if (!$user_data || !$user_data->user || empty($user_data->user->location_hierarchy)) {
         return $position;
     }
     $best_position = $user_data->user->location_hierarchy[0];
     switch ($best_position->level_name) {
         case 'exact':
             $position['accuracy'] = 10;
             break;
         case 'postal':
             $position['accuracy'] = 20;
             break;
         case 'city':
             $position['accuracy'] = 30;
             break;
         default:
             $position['accuracy'] = 60;
             break;
     }
     $position['latitude'] = $best_position->latitude;
     $position['longitude'] = $best_position->longitude;
     $position['date'] = strtotime($best_position->located_at);
     return $position;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:31,代码来源:fireeagle.php


示例5: localeDateTime

 /**
  * Returns the date time in a particular format. Takes the locale into
  * account.
  *
  * @param string|\DateTime $dateTime
  * @param string           $format
  *
  * @return string Formatted date and time
  */
 public function localeDateTime($dateTime, $format = '%B %e, %Y %H:%M')
 {
     if (!$dateTime instanceof \DateTime) {
         $dateTime = new \DateTime($dateTime);
     }
     // Check for Windows to find and replace the %e modifier correctly
     // @see: http://php.net/strftime
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\\1%#d', $format);
     }
     // According to http://php.net/manual/en/function.setlocale.php manual
     // if the second parameter is "0", the locale setting is not affected,
     // only the current setting is returned.
     $result = setlocale(LC_ALL, 0);
     if ($result === false) {
         // This shouldn't occur, but.. Dude!
         // You ain't even got locale or English on your platform??
         // Various things we could do. We could fail miserably, but a more
         // graceful approach is to use the datetime to display a default
         // format
         $this->app['logger.system']->error('No valid locale detected. Fallback on DateTime active.', ['event' => 'system']);
         return $dateTime->format('Y-m-d H:i:s');
     } else {
         $timestamp = $dateTime->getTimestamp();
         return strftime($format, $timestamp);
     }
 }
开发者ID:nuffer,项目名称:bolt,代码行数:36,代码来源:TextHandler.php


示例6: Serial

 /**
  * Constructor. Perform some checks about the OS and setserial
  *
  * @return phpSerial
  */
 function Serial()
 {
     setlocale(LC_ALL, "en_US");
     $sysname = php_uname();
     if (substr($sysname, 0, 5) === "Linux") {
         $this->_os = "linux";
         if ($this->_exec("stty --version") === 0) {
             register_shutdown_function(array($this, "deviceClose"));
         } else {
             trigger_error("No stty availible, unable to run.", E_USER_ERROR);
         }
     } elseif (substr($sysname, 0, 6) === "Darwin") {
         $this->_os = "osx";
         // We know stty is available in Darwin.
         // stty returns 1 when run from php, because "stty: stdin isn't a
         // terminal"
         // skip this check
         //                      if($this->_exec("stty") === 0)
         //                      {
         register_shutdown_function(array($this, "deviceClose"));
         //                      }
         //                      else
         //                      {
         //                              trigger_error("No stty availible, unable to run.", E_USER_ERROR);
         //                      }
     } elseif (substr($sysname, 0, 7) === "Windows") {
         $this->_os = "windows";
         register_shutdown_function(array($this, "deviceClose"));
     } else {
         trigger_error("Host OS is neither osx, linux nor windows, unable tu run.", E_USER_ERROR);
         exit;
     }
 }
开发者ID:Alfiriny,项目名称:jpos2015-opensource,代码行数:38,代码来源:Serial.php


示例7: zeichne_beitrag

function zeichne_beitrag($param)
{
    $Erster = $param['Erster'];
    $ForumId = $param['ForumId'];
    $BeitragId = $param['BeitragId'];
    $Autor = $param['Autor'];
    $AutorURL = rawurlencode($Autor);
    $StempelLetzter = $param['StempelLetzter'];
    $Thema = $param['Thema'];
    $Inhalt = $param['Inhalt'];
    $Egl = $param['Egl'];
    $Atavar = $param['Atavar'];
    setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
    $datum = strftime("%d.%b.%Y", $StempelLetzter);
    $zeit = date("H.i:s", $StempelLetzter);
    if ($Erster) {
        echo "      <tr>\n        <th class=\"ueber\" align=\"center\" width=\"100%\" colspan=\"2\">{$Thema}</th>\n      </tr>\n";
    }
    echo "      <tr>\n        <td colspan=\"2\">\n          <table class=\"beitrag\">\n            <tr>\n              <th class=\"ueber\" align=\"left\" colspan=\"2\"><a href=\"mitglieder-profil.php?alias={$AutorURL}\">{$Autor}</a></th>\n              <th class=\"ueber\" align=\"right\">{$datum} {$zeit}</th>\n            </tr>\n            <tr>\n";
    if ($Atavar > -1) {
        echo "              <td class=\"col-dunkel\" valign=\"top\">\n                <div class=\"atavar\">\n                  <img src=\"atavar-ausgeben.php?atavar={$Atavar}\">\n                </div>\n              </td>\n              <td class=\"col-hell\" valign=\"top\" colspan=\"2\" width=\"100%\">{$Inhalt}</td>\n";
    } else {
        echo "              <td class=\"col-hell\" valign=\"top\" colspan=\"3\" width=\"100%\">{$Inhalt}</td>\n";
    }
    echo "            </tr>\n          </table>\n        </td>\n      </tr>\n";
    // Die Antwort Zeile
    if ($Egl) {
        echo "      <tr>\n        <td><font size=\"-1\"><input type=\"radio\" name=\"eltern\" value=\"{$BeitragId}\"";
        if ($Erster) {
            echo ' checked';
        }
        echo ">Antworten auf diesen Beitrag</font></td>\n        <td align=\"right\"><font size=\"-1\"><button type=\"submit\" name=\"zid\" value=\"{$BeitragId}\">zitieren</button></font></td>\n      </tr>\n";
    }
}
开发者ID:BackupTheBerlios,项目名称:babylon,代码行数:34,代码来源:xp.php


示例8: init

 public function init($configFile)
 {
     if (!file_exists($configFile) || !is_file($configFile)) {
         die("Missing main configuration file");
     }
     //$x = setlocale(LC_TIME, 'ru_RU.CP1251', 'ru_RU.cp1251', 'Russian_Russia.1251');
     $x = setlocale(LC_ALL, 'rus_RUS.65001', 'rus_RUS.65001', 'Russian_Russia.65001');
     $xml = simplexml_load_file($configFile);
     foreach ($xml->module as $module) {
         $configuration = new ConfigParameter($module->asXML());
         $class = $configuration->get('class');
         if (!$class) {
             die("Module has no class");
         }
         $module_id = $configuration->get('id');
         if (!$module_id) {
             die("Module has no ID");
         }
         if (Project::exists($module_id)) {
             // TODO:: write to log file
             //die("Module id already busy:".$module_id);
         }
         $module = new $class();
         $module->initialize($configuration);
         if ($module->setToRegistry() === true) {
             Project::set($module_id, $module);
         }
         unset($module);
     }
 }
开发者ID:amanai,项目名称:next24,代码行数:30,代码来源:CApp.php


示例9: getSelect

 public static function getSelect($menu)
 {
     date_default_timezone_set('America/Bogota');
     setlocale(LC_ALL, 'es_ES.UTF-8');
     $base = bu('programacion');
     $hoy = mktime(0, 0, 0, date('m'), date('j'), date('Y'));
     $html = '';
     $manana = $hoy + 86400;
     $ya = false;
     $ruri = Yii::app()->request->requestUri;
     $html .= '<select name="dia_programacion" id="dia_programacion">';
     foreach ($menu as $item) {
         $selected = '';
         $url = $base . '?dia=' . date('j', $item) . '&mes=' . date('m', $item) . '&anio=' . date('Y', $item);
         if (!$ya) {
             if ($url == $ruri) {
                 $selected = " selected='selected'";
                 $ya = true;
             } elseif ($item >= $hoy && $item < $manana) {
                 $selected = " selected='selected'";
             } else {
                 $selected = '';
             }
         }
         $html .= '<option value="' . $url . '"' . $selected . '>';
         $html .= ucfirst(strftime("%A", $item)) . ' ' . strftime("%e", $item);
         $html .= '</option>';
     }
     $html .= '</select>';
     return $html;
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:31,代码来源:ProgramacionW.php


示例10: parserAction

 /**
  * @Route("/admin/parser")
  * @Method("GET")
  * @Template()
  */
 public function parserAction()
 {
     set_time_limit(0);
     $rootDir = $this->get('kernel')->getRootDir();
     $content = file_get_contents(realpath($rootDir . '/../docs/google-groups-posts.bkp.html'));
     $crawler = new Crawler($content);
     $subjectFilterPrefix = 'pergunta';
     $em = $this->get('doctrine')->getManager();
     $crawler->filter('body > table > tbody > tr > td > div > div > div:first-child')->each(function (Crawler $node, $i) use(&$subjectFilterPrefix, $em) {
         $subject = $node->filter('a')->first();
         $author = $node->filter('div:first-child > div')->attr('data-name');
         $time = $node->filter('div')->last()->children()->attr('title');
         setlocale(LC_ALL, NULL);
         setlocale(LC_ALL, 'pt_BR');
         if (substr(strtolower(utf8_decode($subject->text())), 0, strlen($subjectFilterPrefix)) == $subjectFilterPrefix) {
             $timeParts = explode(',', utf8_decode($time));
             $timeParsed = strptime(end($timeParts), '%d de %B de %Y %Hh%Mmin%Ss');
             $createdAt = new \DateTime(date('Y-m-d h:i:s', mktime($timeParsed['tm_hour'], $timeParsed['tm_min'], $timeParsed['tm_sec'], 1, $timeParsed['tm_yday'] + 1, $timeParsed['tm_year'] + 1900)));
             $entity = $em->getRepository('CekurteZCPEBundle:Parser')->findOneBy(array('subject' => utf8_decode($subject->text())));
             if (!$entity instanceof Parser) {
                 $parser = new Parser();
                 $parser->setSubject(utf8_decode($subject->text()))->setUrl($subject->attr('href'))->setAuthor(utf8_decode($author))->setCreatedAt($createdAt);
                 $em->persist($parser);
                 $em->flush();
             }
         }
     });
     return array();
 }
开发者ID:andrelotto,项目名称:zcpe,代码行数:34,代码来源:DefaultController.php


示例11: index

 public function index()
 {
     Carbon::setLocale('de');
     setlocale(LC_TIME, 'de_DE.utf8');
     $myTipps = Tipp::join('matches', 'tipps.match_id', '=', 'matches.id')->join('clubs as homeclub', 'matches.home_id', '=', 'homeclub.id')->join('clubs as awayclub', 'matches.away_id', '=', 'awayclub.id')->select('matches.home_goals as erg1', 'matches.away_goals as erg2', 'matches.date', 'tipps.*', 'homeclub.club as home', 'awayclub.club as away')->where('tipps.user_id', '=', Auth::id())->orderBy('date')->get();
     return view('pages.tipps', compact('myTipps'));
 }
开发者ID:sewede,项目名称:footipp,代码行数:7,代码来源:TippsController.php


示例12: testExtract

 /**
  * Tests ability to extract EXIF data without errors. Does not test data
  * for validity.
  */
 public function testExtract()
 {
     $fixture = __DIR__ . '/../Fixtures/img_exif.jpg';
     setlocale(LC_ALL, 'de_DE');
     self::$_data = self::$_exif->getData($fixture);
     $this->assertInternalType('array', self::$_data);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:11,代码来源:TestBase.php


示例13: set_language

function set_language()
{
    global $amp_conf, $db;
    $nt = notifications::create($db);
    if (extension_loaded('gettext')) {
        $nt->delete('core', 'GETTEXT');
        if (php_sapi_name() !== 'cli') {
            if (empty($_COOKIE['lang']) || !preg_match('/^[\\w\\._@-]+$/', $_COOKIE['lang'], $matches)) {
                $lang = $amp_conf['UIDEFAULTLANG'] ? $amp_conf['UIDEFAULTLANG'] : 'en_US';
                if (empty($_COOKIE['lang'])) {
                    setcookie("lang", $lang);
                }
            } else {
                preg_match('/^([\\w\\._@-]+)$/', $_COOKIE['lang'], $matches);
                $lang = !empty($matches[1]) ? $matches[1] : 'en_US';
            }
            $_COOKIE['lang'] = $lang;
        } else {
            $lang = $amp_conf['UIDEFAULTLANG'] ? $amp_conf['UIDEFAULTLANG'] : 'en_US';
        }
        putenv('LC_ALL=' . $lang);
        putenv('LANG=' . $lang);
        putenv('LANGUAGE=' . $lang);
        setlocale(LC_ALL, $lang);
        bindtextdomain('amp', $amp_conf['AMPWEBROOT'] . '/admin/i18n');
        bind_textdomain_codeset('amp', 'utf8');
        textdomain('amp');
        return $lang;
    }
    $nt->add_warning('core', 'GETTEXT', _("Gettext is not installed"), _("Please install gettext so that the PBX can properly translate itself"), 'https://www.gnu.org/software/gettext/');
    return 'en_US';
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:32,代码来源:view.functions.php


示例14: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $piwikLanguages = \Piwik\Plugins\LanguagesManager\API::getInstance()->getAvailableLanguages();
     $aliasesUrl = 'https://raw.githubusercontent.com/unicode-cldr/cldr-core/master/supplemental/aliases.json';
     $aliasesData = Http::fetchRemoteFile($aliasesUrl);
     $aliasesData = json_decode($aliasesData, true);
     $aliasesData = $aliasesData['supplemental']['metadata']['alias']['languageAlias'];
     $writePath = Filesystem::getPathToPiwikRoot() . '/plugins/Intl/lang/%s.json';
     foreach ($piwikLanguages as $langCode) {
         if ($langCode == 'dev') {
             continue;
         }
         $requestLangCode = $transformedLangCode = $this->transformLangCode($langCode);
         if (array_key_exists($requestLangCode, $aliasesData)) {
             $requestLangCode = $aliasesData[$requestLangCode]['_replacement'];
         }
         // fix some locales
         $localFixes = array('pt' => 'pt-PT', 'pt-br' => 'pt', 'zh-cn' => 'zh-Hans', 'zh-tw' => 'zh-Hant');
         if (array_key_exists($langCode, $localFixes)) {
             $requestLangCode = $localFixes[$langCode];
         }
         setlocale(LC_ALL, $langCode);
         $translations = array();
         $this->fetchLanguageData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchTerritoryData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchCalendarData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchLayoutDirection($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchUnitData($output, $transformedLangCode, $requestLangCode, $translations);
         $this->fetchNumberFormattingData($output, $transformedLangCode, $requestLangCode, $translations);
         ksort($translations['Intl']);
         file_put_contents(sprintf($writePath, $langCode), json_encode($translations, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
     }
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:33,代码来源:GenerateIntl.php


示例15: smarty_modifier_locale

function smarty_modifier_locale($stream, $locale)
{
    setlocale("LC_ALL", $locale);
    setlocale("LC_TIME", $locale);
    setlocale("LC_LANG", $locale);
    return $stream;
}
开发者ID:BackupTheBerlios,项目名称:loquacity-svn,代码行数:7,代码来源:modifier.locale.php


示例16: __construct

 public function __construct($dataDirectory)
 {
     //
     // Default to English for lack of anything better
     //
     $this->clientLang = 'en-us';
     //
     // See if we can find anything better
     //
     $matches = array();
     if (array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) {
         setlocale(LC_ALL, 'en-US');
         if (preg_match('/(en-US|fr-FR|de-DE|it-IT|es-ES|sv-SV|sv-SE|nl-NL)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches)) {
             $this->clientLang = strtolower($matches[1]);
         }
     }
     //
     // Pull in all of the strings we need
     //
     $lang2file = array("es-es" => "es-ES.xml", "en-us" => "en-US.xml", "de-de" => "de-DE.xml", "fr-fr" => "fr-FR.xml", "it-it" => "it-IT.xml", "nl-nl" => "nl-NL.xml", "sv-sv" => "sv-SE.xml", "sv-se" => "sv-SE.xml");
     $xml_parser = xml_parser_create();
     $l10nValues = array();
     $l10nIndexes = array();
     $l10nContents = file_get_contents("{$dataDirectory}/" . $lang2file[$this->getClientLang()]);
     if (!xml_parse_into_struct($xml_parser, $l10nContents, $l10nValues, $l10nIndexes)) {
         die(sprintf("l10n: XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
     } else {
         foreach ($l10nIndexes["STRING"] as $l10nStringIndex) {
             $this->l10n[$l10nValues[$l10nStringIndex]["attributes"]["ID"]] = $l10nValues[$l10nStringIndex]["value"];
         }
     }
     xml_parser_free($xml_parser);
 }
开发者ID:roitiger,项目名称:sonosmusix,代码行数:33,代码来源:localizer.php


示例17: qa_initialize_php

function qa_initialize_php()
{
    if (qa_php_version_below('4.3')) {
        qa_fatal_error('This requires PHP 4.3 or later');
    }
    error_reporting(E_ALL);
    // be ultra-strict about error checking
    @ini_set('magic_quotes_runtime', 0);
    @setlocale(LC_CTYPE, 'C');
    // prevent strtolower() et al affecting non-ASCII characters (appears important for IIS)
    if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
        @date_default_timezone_set(@date_default_timezone_get());
    }
    // prevent PHP notices where default timezone not set
    if (ini_get('register_globals')) {
        $checkarrays = array('_ENV', '_GET', '_POST', '_COOKIE', '_SERVER', '_FILES', '_REQUEST', '_SESSION');
        // unregister globals if they're registered
        $keyprotect = array_flip(array_merge($checkarrays, array('GLOBALS')));
        foreach ($checkarrays as $checkarray) {
            if (isset(${$checkarray}) && is_array(${$checkarray})) {
                foreach (${$checkarray} as $checkkey => $checkvalue) {
                    if (isset($keyprotect[$checkkey])) {
                        qa_fatal_error('My superglobals are not for overriding');
                    } else {
                        unset($GLOBALS[$checkkey]);
                    }
                }
            }
        }
    }
}
开发者ID:netham91,项目名称:question2answer,代码行数:31,代码来源:qa-base.php


示例18: tgl

function tgl($date)
{
    setlocale(LC_TIME, 'INDONESIAN');
    $st = strftime("%d/%m/%Y", strtotime($date));
    //return strtoupper($st);
    return $st;
}
开发者ID:agusneos,项目名称:ppic,代码行数:7,代码来源:v_kartuorder_card_print.php


示例19: __construct

 function __construct()
 {
     if (!setlocale(LC_ALL, 'zh_CN.gbk')) {
         setlocale(LC_ALL, "chs");
     }
     $this->charset = kernel::single('base_charset');
 }
开发者ID:453111208,项目名称:bbc,代码行数:7,代码来源:csv.php


示例20: processData

function processData($data)
{
    global $db, $drop;
    $data = $data->toArray();
    foreach ($data as $collection => $entities) {
        if ($drop) {
            $db->{$collection}->drop();
        }
        foreach ($entities as $entity) {
            echo "Generating {$collection} " . (@$entity['_id'] ?: "new") . PHP_EOL;
            if (!isset($entity['_id'])) {
                $entity['_id'] = (string) new \MongoId();
            }
            if ($collection === 'user') {
                setlocale(LC_CTYPE, 'en_US.utf8');
                if (isset($entity['firstName'])) {
                    $fistNameSorting = utf8_encode(iconv("UTF-8", 'ASCII//TRANSLIT', $entity['firstName']));
                    $fistNameSorting = strtolower($fistNameSorting);
                    $entity['firstName_sorting'] = $fistNameSorting;
                }
                if (isset($entity['lastName'])) {
                    $lastNameSorting = utf8_encode(iconv("UTF-8", 'ASCII//TRANSLIT', $entity['lastName']));
                    $lastNameSorting = strtolower($lastNameSorting);
                    $entity['lastName_sorting'] = $lastNameSorting;
                }
            }
            $db->{$collection}->save($entity);
        }
    }
    //$db->user->ensureIndex(array('userName' => 1), array('unique'=>1));
    $db->org_mock->ensureIndex(array('name' => 1), array('unique' => 1));
}
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:32,代码来源:load.mongodb.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP setloginstatus函数代码示例发布时间:2022-05-15
下一篇:
PHP setglobal函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap