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

PHP preg_split函数代码示例

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

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



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

示例1: sendData

 protected static function sendData($host, $POST, $HEAD, $filepath, $mediafile, $TAIL)
 {
     $sock = fsockopen("ssl://" . $host, 443);
     fwrite($sock, $POST);
     fwrite($sock, $HEAD);
     //write file data
     $buf = 1024;
     $totalread = 0;
     $fp = fopen($filepath, "r");
     while ($totalread < $mediafile['filesize']) {
         $buff = fread($fp, $buf);
         fwrite($sock, $buff, $buf);
         $totalread += $buf;
     }
     //echo $TAIL;
     fwrite($sock, $TAIL);
     sleep(1);
     $data = fgets($sock, 8192);
     $data .= fgets($sock, 8192);
     $data .= fgets($sock, 8192);
     $data .= fgets($sock, 8192);
     $data .= fgets($sock, 8192);
     $data .= fgets($sock, 8192);
     $data .= fgets($sock, 8192);
     fclose($sock);
     list($header, $body) = preg_split("/\\R\\R/", $data, 2);
     $json = json_decode($body);
     if (!is_null($json)) {
         return $json;
     }
     return false;
 }
开发者ID:abazad,项目名称:whatsappGUI,代码行数:32,代码来源:mediauploader.php


示例2: lang_getfrombrowser

/**
 * determines the langauge settings of the browser, details see here:
 * http://aktuell.de.selfhtml.org/artikel/php/httpsprache/
 */
function lang_getfrombrowser($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true)
{
    // $_SERVER['HTTP_ACCEPT_LANGUAGE'] verwenden, wenn keine Sprachvariable mitgegeben wurde
    if ($lang_variable === null && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        $lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
    }
    // wurde irgendwelche Information mitgeschickt?
    if (empty($lang_variable)) {
        // Nein? => Standardsprache zurückgeben
        return $default_language;
    }
    // Den Header auftrennen
    $accepted_languages = preg_split('/,\\s*/', $lang_variable);
    // Die Standardwerte einstellen
    $current_lang = $default_language;
    $current_q = 0;
    // Nun alle mitgegebenen Sprachen abarbeiten
    foreach ($accepted_languages as $accepted_language) {
        // Alle Infos über diese Sprache rausholen
        $res = preg_match('/^([a-z]{1,8}(?:-[a-z]{1,8})*)' . '(?:;\\s*q=(0(?:\\.[0-9]{1,3})?|1(?:\\.0{1,3})?))?$/i', $accepted_language, $matches);
        // war die Syntax gültig?
        if (!$res) {
            // Nein? Dann ignorieren
            continue;
        }
        // Sprachcode holen und dann sofort in die Einzelteile trennen
        $lang_code = explode('-', $matches[1]);
        // Wurde eine Qualität mitgegeben?
        if (isset($matches[2])) {
            // die Qualität benutzen
            $lang_quality = (double) $matches[2];
        } else {
            // Kompabilitätsmodus: Qualität 1 annehmen
            $lang_quality = 1.0;
        }
        // Bis der Sprachcode leer ist...
        while (count($lang_code)) {
            // mal sehen, ob der Sprachcode angeboten wird
            if (in_array(strtolower(join('-', $lang_code)), $allowed_languages)) {
                // Qualität anschauen
                if ($lang_quality > $current_q) {
                    // diese Sprache verwenden
                    $current_lang = strtolower(join('-', $lang_code));
                    $current_q = $lang_quality;
                    // Hier die innere while-Schleife verlassen
                    break;
                }
            }
            // Wenn wir im strengen Modus sind, die Sprache nicht versuchen zu minimalisieren
            if ($strict_mode) {
                // innere While-Schleife aufbrechen
                break;
            }
            // den rechtesten Teil des Sprachcodes abschneiden
            array_pop($lang_code);
        }
    }
    // die gefundene Sprache zurückgeben
    return $current_lang;
}
开发者ID:adartk,项目名称:phpsqlitecms,代码行数:64,代码来源:language_redirect.php


示例3: addUserFacebook

 /**
  * Add facebook user
  */
 public function addUserFacebook($aVals, $iFacebookUserId, $sAccessToken)
 {
     if (!defined('PHPFOX_IS_FB_USER')) {
         define('PHPFOX_IS_FB_USER', true);
     }
     //get facebook setting
     $bFbConnect = Phpfox::getParam('facebook.enable_facebook_connect');
     if ($bFbConnect == false) {
         return false;
     } else {
         if (Phpfox::getService('accountapi.facebook')->checkUserFacebook($iFacebookUserId) == false) {
             if (Phpfox::getParam('user.disable_username_on_sign_up')) {
                 $aVals['user_name'] = Phpfox::getLib('parse.input')->cleanTitle($aVals['full_name']);
             }
             $aVals['country_iso'] = null;
             if (Phpfox::getParam('user.split_full_name')) {
                 $aNameSplit = preg_split('[ ]', $aVals['full_name']);
                 $aVals['first_name'] = $aNameSplit[0];
                 unset($aNameSplit[0]);
                 $aVals['last_name'] = implode(' ', $aNameSplit);
             }
             $iUserId = Phpfox::getService('user.process')->add($aVals);
             if ($iUserId === false) {
                 return false;
             } else {
                 Phpfox::getService('facebook.process')->addUser($iUserId, $iFacebookUserId);
                 //update fb profile image to db
                 $bCheck = Phpfox::getService('accountapi.facebook')->addImagePicture($sAccessToken, $iUserId);
             }
         }
     }
     return true;
 }
开发者ID:PhpFoxPro,项目名称:Better-Mobile-Module,代码行数:36,代码来源:facebook.class.php


示例4: escapeArgument

 /**
  * Escapes a string to be used as a shell argument.
  *
  * @param string $argument The argument that will be escaped
  *
  * @return string The escaped argument
  */
 public static function escapeArgument($argument)
 {
     //Fix for PHP bug #43784 escapeshellarg removes % from given string
     //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
     //@see https://bugs.php.net/bug.php?id=43784
     //@see https://bugs.php.net/bug.php?id=49446
     if ('\\' === DIRECTORY_SEPARATOR) {
         if ('' === $argument) {
             return escapeshellarg($argument);
         }
         $escapedArgument = '';
         $quote = false;
         foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
             if ('"' === $part) {
                 $escapedArgument .= '\\"';
             } elseif (self::isSurroundedBy($part, '%')) {
                 // Avoid environment variable expansion
                 $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%';
             } else {
                 // escape trailing backslash
                 if ('\\' === substr($part, -1)) {
                     $part .= '\\';
                 }
                 $quote = true;
                 $escapedArgument .= $part;
             }
         }
         if ($quote) {
             $escapedArgument = '"' . $escapedArgument . '"';
         }
         return $escapedArgument;
     }
     return escapeshellarg($argument);
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:41,代码来源:ProcessUtils.php


示例5: getSuggestion

 function getSuggestion($word)
 {
     if ($fh = fopen($this->tmpfile, "w")) {
         fwrite($fh, "!\n");
         fwrite($fh, "^{$word}\n");
         fclose($fh);
     } else {
         die("Error opening tmp file.");
     }
     $data = shell_exec($this->cmd);
     $returnData = array();
     $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
     foreach ($dataArr as $dstr) {
         $matches = array();
         // Skip this line.
         if (strpos($dstr, "@") === 0) {
             continue;
         }
         preg_match("/\\& .* .* .*: (.*)/i", $dstr, $matches);
         if (!empty($matches[1])) {
             // For some reason, the exec version seems to add commas?
             $returnData[] = str_replace(",", "", $matches[1]);
         }
     }
     return $returnData;
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:26,代码来源:TinyPspellShell.class.php


示例6: formatVueGridName

 private function formatVueGridName()
 {
     $gridName = preg_split('/(?=[A-Z])/', $this->modelName);
     $gridName = implode('-', $gridName);
     $gridName = ltrim($gridName, '-');
     return $gridName = strtolower($gridName);
 }
开发者ID:evercode1,项目名称:view-maker,代码行数:7,代码来源:FormatsTokens.php


示例7: compile

 public static function compile($source, $path, $todir, $importdirs)
 {
     // call Less to compile
     $parser = new lessc();
     $parser->setImportDir(array_keys($importdirs));
     $parser->setPreserveComments(true);
     $output = $parser->compile($source);
     // update url
     $arr = preg_split(CANVASLess::$rsplitbegin . CANVASLess::$kfilepath . CANVASLess::$rsplitend, $output, -1, PREG_SPLIT_DELIM_CAPTURE);
     $output = '';
     $file = $relpath = '';
     $isfile = false;
     foreach ($arr as $s) {
         if ($isfile) {
             $isfile = false;
             $file = $s;
             $relpath = CANVASLess::relativePath($todir, dirname($file));
             $output .= "\n#" . CANVASLess::$kfilepath . "{content: \"{$file}\";}\n";
         } else {
             $output .= ($file ? CANVASPath::updateUrl($s, $relpath) : $s) . "\n\n";
             $isfile = true;
         }
     }
     return $output;
 }
开发者ID:shamsbd71,项目名称:canvas-framework,代码行数:25,代码来源:legacy.less.php


示例8: __construct

 /**
  *
  * @param String $file
  * @throws \Exception
  */
 public function __construct($file)
 {
     $this->_position = 0;
     if (is_array($file) && strlen(rtrim($file[0], chr(10) . chr(13) . "\n" . "\r")) == 400) {
         $this->file = $file;
     } else {
         if (is_file($file) && file_exists($file)) {
             $this->file = file($file);
         } else {
             if (is_string($file)) {
                 $this->file = preg_split('/\\r\\n|\\r|\\n/', $file);
                 if (empty(last($this->file))) {
                     array_pop($this->file);
                 }
             } else {
                 throw new \Exception("Arquivo: não existe");
             }
         }
     }
     $this->isRetorno = substr($this->file[0], 0, 9) == '02RETORNO' ? true : false;
     if (!in_array(substr($this->file[0], 76, 3), array_keys($this->bancos))) {
         throw new \Exception(sprintf("Banco: %s, inválido", substr($this->file[0], 76, 3)));
     }
     $this->header = new Header();
     $this->trailer = new Trailer();
 }
开发者ID:jhonleandres,项目名称:laravel-boleto,代码行数:31,代码来源:AbstractCnab.php


示例9: __construct

 /**
  * Constructs the class with given parameters and reads object related data from the bitstream.
  *
  * The following options are currently recognized:
  *  o vorbisContext -- Indicates whether to expect comments to be in the context of a vorbis bitstream or not. This
  *    option can be used to parse vorbis comments in another formats, eg FLAC, that do not use for example the
  *    framing flags. Defaults to true.
  *
  * @param HausDesign_Io_Reader $reader The reader object.
  * @param Array          $options Array of options.
  */
 public function __construct($reader, $options = array())
 {
     if (!isset($options['vorbisContext']) || $options['vorbisContext']) {
         parent::__construct($reader);
     } else {
         $this->_reader = $reader;
     }
     $this->_vendor = $this->_reader->read($this->_reader->readUInt32LE());
     $userCommentListLength = $this->_reader->readUInt32LE();
     for ($i = 0; $i < $userCommentListLength; $i++) {
         list($name, $value) = preg_split('/=/', $this->_reader->read($this->_reader->readUInt32LE()), 2);
         if (!isset($this->_comments[strtoupper($name)])) {
             $this->_comments[strtoupper($name)] = array();
         }
         $this->_comments[strtoupper($name)][] = $value;
     }
     if (!isset($options['vorbisContext']) || $options['vorbisContext']) {
         $this->_framingFlag = $this->_reader->readUInt8() & 0x1;
         if ($this->_framingFlag == 0) {
             require_once 'HausDesign/Media/Vorbis/Exception.php';
             throw new HausDesign_Media_Vorbis_Exception('Undecodable Vorbis stream');
         }
         $this->_reader->skip($this->_packetSize - $this->_reader->getOffset() + 30);
     }
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:36,代码来源:Comment.php


示例10: parse_in

 function parse_in($value)
 {
     $values = preg_split('/\\s+/', trim($value));
     switch (count($values)) {
         case 1:
             $v1 = $values[0];
             return array($v1, $v1, $v1, $v1);
         case 2:
             $v1 = $values[0];
             $v2 = $values[1];
             return array($v1, $v2, $v1, $v2);
         case 3:
             $v1 = $values[0];
             $v2 = $values[1];
             $v3 = $values[2];
             return array($v1, $v2, $v3, $v2);
         case 4:
             $v1 = $values[0];
             $v2 = $values[1];
             $v3 = $values[2];
             $v4 = $values[3];
             return array($v1, $v2, $v3, $v4);
         default:
             // We newer should get there, because 'padding' value can contain from 1 to 4 widths
             return array(0, 0, 0, 0);
     }
 }
开发者ID:isantiago,项目名称:foswiki,代码行数:27,代码来源:css.padding.inc.php


示例11: getFileForPhotoWithScale

 /**
  * getFileForPhotoWithScale function.
  * 
  * @access private
  * @param Models\Photo $photo
  * @param mixed $scale
  * @return [$file, $temp, $mtime]
  */
 private static function getFileForPhotoWithScale(Models\Photo $photo, $scale)
 {
     $extension = $photo->extension;
     $bucket = 'other';
     $path = '';
     if ($scale == 'photo') {
         if ($photo->get('modified')) {
             $path = '/' . $photo->get('id') . '_mod.' . $extension;
         } else {
             $bucket = 'photo';
             $path = rtrim('/' . ltrim($photo->get('path'), '/'), '/') . '/' . $photo->get('filename');
         }
     } elseif ($scale == 'scaled') {
         $thumbSize = Models\Preferences::valueForModuleWithKey('CameraLife', 'scaledsize');
         $path = "/{$photo->get('id')}_{$thumbSize}.{$extension}";
     } elseif ($scale == 'thumbnail') {
         $thumbSize = Models\Preferences::valueForModuleWithKey('CameraLife', 'thumbsize');
         $path = "/{$photo->get('id')}_{$thumbSize}.{$extension}";
     } elseif (is_numeric($scale)) {
         $valid = preg_split('/[, ]+/', Models\Preferences::valueForModuleWithKey('CameraLife', 'optionsizes'));
         if (!in_array($scale, $valid)) {
             throw new \Exception('This image size has not been allowed');
         }
         $path = "/{$photo->get('id')}_{$scale}.{$extension}";
     } else {
         throw new \Exception('Missing or bad size parameter');
     }
     $fileStore = Models\FileStore::fileStoreWithName($bucket);
     list($file, $temp, $mtime) = $fileStore->getFile($path);
     if (!$file) {
         $photo->generateThumbnail();
         list($file, $temp, $mtime) = $fileStore->getFile($path);
     }
     return [$file, $temp, $mtime];
 }
开发者ID:fulldecent,项目名称:cameralife,代码行数:43,代码来源:MediaController.php


示例12: init

 private function init()
 {
     $this->Controller = $this->Request->attributes->get('_template')->get('controller');
     $this->Route = $this->Request->attributes->get('_route');
     list(, $this->Vendor, $this->Bundle, ) = preg_split('/(?=[A-Z])/', $this->Request->attributes->get('_template')->get('bundle'));
     $this->BundlePath = __DIR__ . '/../../' . $this->Bundle . 'Bundle';
 }
开发者ID:hamidudc,项目名称:Proshut,代码行数:7,代码来源:FactoryController.php


示例13: api_get_canonical_id

function api_get_canonical_id($id)
{
    $alias_file = ROOT . "/.htaliases";
    $canon = api_get_request_id($id);
    if ($id == "" || !file_exists($alias_file)) {
        return $canon;
    }
    $fd = fopen($alias_file, "r");
    if ($fd == FALSE) {
        return $canon;
    }
    while (!feof($fd)) {
        $line = fgets($fd, 1024);
        if (substr($line, 0, 1) == "#") {
            continue;
        }
        $match = preg_split('/( |\\t|\\r|\\n)+/', $line);
        if ($id == $match[0]) {
            $canon = $match[1];
            break;
        }
    }
    fclose($fd);
    return $canon;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:25,代码来源:api.php


示例14: parse

 /**
  * @param  string $string
  * @return Diff[]
  */
 public function parse($string)
 {
     $lines = preg_split('(\\r\\n|\\r|\\n)', $string);
     $lineCount = count($lines);
     $diffs = array();
     $diff = null;
     $collected = array();
     for ($i = 0; $i < $lineCount; ++$i) {
         if (preg_match('(^---\\s+(?P<file>\\S+))', $lines[$i], $fromMatch) && preg_match('(^\\+\\+\\+\\s+(?P<file>\\S+))', $lines[$i + 1], $toMatch)) {
             if ($diff !== null) {
                 $this->parseFileDiff($diff, $collected);
                 $diffs[] = $diff;
                 $collected = array();
             }
             $diff = new Diff($fromMatch['file'], $toMatch['file']);
             ++$i;
         } else {
             if (preg_match('/^(?:diff --git |index [\\da-f\\.]+|[+-]{3} [ab])/', $lines[$i])) {
                 continue;
             }
             $collected[] = $lines[$i];
         }
     }
     if (count($collected) && $diff !== null) {
         $this->parseFileDiff($diff, $collected);
         $diffs[] = $diff;
     }
     return $diffs;
 }
开发者ID:scrobot,项目名称:Lumen,代码行数:33,代码来源:Parser.php


示例15: import

 /**
  *
  */
 public function import($csv)
 {
     // convert to UTF-8
     $head = substr($csv, 0, 4096);
     $charset = rcube_charset::detect($head, RCUBE_CHARSET);
     $csv = rcube_charset::convert($csv, $charset);
     $head = '';
     $this->map = array();
     // Parse file
     foreach (preg_split("/[\r\n]+/", $csv) as $line) {
         $elements = $this->parse_line($line);
         if (empty($elements)) {
             continue;
         }
         // Parse header
         if (empty($this->map)) {
             $this->parse_header($elements);
             if (empty($this->map)) {
                 break;
             }
         } else {
             $this->csv_to_vcard($elements);
         }
     }
 }
开发者ID:BIGGANI,项目名称:zpanelx,代码行数:28,代码来源:rcube_csv2vcard.php


示例16: run

 public function run(InputInterface $input, OutputInterface $output)
 {
     // extract real command name
     $tokens = preg_split('{\\s+}', $input->__toString());
     $args = array();
     foreach ($tokens as $token) {
         if ($token && $token[0] !== '-') {
             $args[] = $token;
             if (count($args) >= 2) {
                 break;
             }
         }
     }
     // show help for this command if no command was found
     if (count($args) < 2) {
         return parent::run($input, $output);
     }
     // change to global dir
     $config = Factory::createConfig();
     chdir($config->get('home'));
     $this->getIO()->writeError('<info>Changed current directory to ' . $config->get('home') . '</info>');
     // create new input without "global" command prefix
     $input = new StringInput(preg_replace('{\\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\\b}', '', $input->__toString(), 1));
     $this->getApplication()->resetComposer();
     return $this->getApplication()->run($input, $output);
 }
开发者ID:detain,项目名称:composer,代码行数:26,代码来源:GlobalCommand.php


示例17: ckeditor_parse_php_info

/**
 * http://www.php.net/manual/en/function.phpinfo.php
 * code at adspeed dot com
 * 09-Dec-2005 11:31
 * This function parses the phpinfo output to get details about a PHP module.
 */
function ckeditor_parse_php_info()
{
    ob_start();
    phpinfo(INFO_MODULES);
    $s = ob_get_contents();
    ob_end_clean();
    $s = strip_tags($s, '<h2><th><td>');
    $s = preg_replace('/<th[^>]*>([^<]+)<\\/th>/', "<info>\\1</info>", $s);
    $s = preg_replace('/<td[^>]*>([^<]+)<\\/td>/', "<info>\\1</info>", $s);
    $vTmp = preg_split('/(<h2>[^<]+<\\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE);
    $vModules = array();
    for ($i = 1; $i < count($vTmp); $i++) {
        if (preg_match('/<h2>([^<]+)<\\/h2>/', $vTmp[$i], $vMat)) {
            $vName = trim($vMat[1]);
            $vTmp2 = explode("\n", $vTmp[$i + 1]);
            foreach ($vTmp2 as $vOne) {
                $vPat = '<info>([^<]+)<\\/info>';
                $vPat3 = "/{$vPat}\\s*{$vPat}\\s*{$vPat}/";
                $vPat2 = "/{$vPat}\\s*{$vPat}/";
                if (preg_match($vPat3, $vOne, $vMat)) {
                    // 3cols
                    $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]), trim($vMat[3]));
                } elseif (preg_match($vPat2, $vOne, $vMat)) {
                    // 2cols
                    $vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
                }
            }
        }
    }
    return $vModules;
}
开发者ID:ckeditor-for-wordpress,项目名称:ckeditor-for-wordpress,代码行数:37,代码来源:overview.php


示例18: parse

 static function parse($args)
 {
     $method = strtolower(@$args[1]);
     $string = @$args[0];
     if (empty($string)) {
         return false;
     }
     if (!method_exists('kirbytext', $method)) {
         return $string;
     }
     $replace = array('(', ')');
     $string = str_replace($replace, '', $string);
     $attr = array_merge(self::$tags, self::$attr);
     $search = preg_split('!(' . implode('|', $attr) . '):!i', $string, false, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     $result = array();
     $num = 0;
     foreach ($search as $key) {
         if (!isset($search[$num + 1])) {
             break;
         }
         $key = trim($search[$num]);
         $value = trim($search[$num + 1]);
         $result[$key] = $value;
         $num = $num + 2;
     }
     return self::$method($result);
 }
开发者ID:robeam,项目名称:kirbycms,代码行数:27,代码来源:kirbytext.php


示例19: filter

 /**
  * Filter
  *
  * @return void
  */
 public function filter()
 {
     /*
      * Variable qui contient la chaine de recherche
      */
     if (is_array($this->terms)) {
         $stringSearch = implode(' ', $this->terms);
     } else {
         $stringSearch = $this->terms;
     }
     /*
      * On divise en mots (séparé par des espace)
      */
     $words = preg_split('`\\s+`', $stringSearch, -1, PREG_SPLIT_NO_EMPTY);
     if (count($words) > 1) {
         array_unshift($words, $stringSearch);
     }
     $words = array_unique($words);
     $conds = [];
     foreach ($words as $index => $word) {
         foreach ($this->columns as $colName) {
             $cond = $this->queryBuilder->expr()->like($colName, ':word_' . ($index + 1));
             $this->queryBuilder->setParameter('word_' . ($index + 1), '%' . $word . '%');
             $conds[] = $cond;
         }
     }
     $this->queryBuilder->andWhere(implode(' OR ', $conds));
 }
开发者ID:solire,项目名称:trieur,代码行数:33,代码来源:Contain.php


示例20: parseResponse

 /**
  * {@inheritdoc}
  */
 public function parseResponse($data)
 {
     if ($data === '') {
         return array();
     }
     $info = array();
     $current = null;
     $infoLines = preg_split('/\\r?\\n/', $data);
     if (isset($infoLines[0]) && $infoLines[0][0] !== '#') {
         return parent::parseResponse($data);
     }
     foreach ($infoLines as $row) {
         if ($row === '') {
             continue;
         }
         if (preg_match('/^# (\\w+)$/', $row, $matches)) {
             $info[$matches[1]] = array();
             $current =& $info[$matches[1]];
             continue;
         }
         list($k, $v) = $this->parseRow($row);
         $current[$k] = $v;
     }
     return $info;
 }
开发者ID:flachesis,项目名称:predis,代码行数:28,代码来源:ServerInfoV26x.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP preint_r函数代码示例发布时间:2022-05-15
下一篇:
PHP preg_replace_callback函数代码示例发布时间: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