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


PHP split函数代码示例

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


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

示例1: sync_object

function sync_object($object_type, $object_name)
{
    # Should only provide error information on stderr: put stdout to syslog
    $cmd = "geni-sync-wireless {$object_type} {$object_name}";
    error_log("SYNC(cmd) " . $cmd);
    $descriptors = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
    $process = proc_open($cmd, $descriptors, $pipes);
    $std_output = stream_get_contents($pipes[1]);
    # Should be empty
    $err_output = stream_get_contents($pipes[2]);
    fclose($pipes[1]);
    fclose($pipes[2]);
    $proc_value = proc_close($process);
    $full_output = $std_output . $err_output;
    foreach (split("\n", $full_output) as $line) {
        if (strlen(trim($line)) == 0) {
            continue;
        }
        error_log("SYNC(output) " . $line);
    }
    if ($proc_value != RESPONSE_ERROR::NONE) {
        error_log("WIRELESS SYNC error: {$proc_value}");
    }
    return $proc_value;
}
开发者ID:ahelsing,项目名称:geni-portal,代码行数:25,代码来源:wireless_operations.php

示例2: save_data

 function save_data($db_object, $common, $fLang_id, $_POST, $default)
 {
     $id = array();
     while (list($key, $value) = each($_POST)) {
         ${$key} = $value;
         if (ereg("^lang_", $key)) {
             $id[] = substr($key, 5);
         }
         if (ereg("^charset_", $key)) {
             $ids = split("_", $key);
             $id1 = $ids[1];
             $char[$id1] = $value;
         }
     }
     $charset_table = $common->prefix_table("language_charset");
     while (list($kk, $vv) = @each($char)) {
         $upqry = "update {$charset_table} set charset='{$vv}' where language_id='{$kk}'";
         $upqry = "replace into {$charset_table} set language_id='{$kk}',charset='{$vv}'";
         $db_object->insert($upqry);
     }
     $lang_table = $common->prefix_table("language");
     $lang = "lang_" . $fLang_id;
     for ($i = 0; $i < count($id); $i++) {
         $lan = "lang_" . $id[$i];
         $lan = ${$lan};
         $mysql = "update {$lang_table} set {$lang}='{$lan}' where lang_id='{$id[$i]}'";
         $db_object->insert($mysql);
     }
 }
开发者ID:nloadholtes,项目名称:people-prodigy,代码行数:29,代码来源:edit_lang.php

示例3: request

 function request($info)
 {
     $httpObj = new http_class();
     $nhHttp = new nhhttp($httpObj);
     $partnerId = 10;
     //Điền partnerID đc cung cấp
     $key = 'x@l0-th1nkn3t';
     // Điền key của Partner đc cung cấp
     //print_r($_REQUEST);
     $paymentMethodList = split("\\.", trim($_REQUEST['m']));
     //print_r($paymentMethodList);
     $paymentMethod = trim($paymentMethodList[0]);
     $postValue = array();
     $postValue['o'] = "requestTransaction";
     $postValue['itemid'] = $info['product_id'];
     $postValue['itemdesc'] = urlencode($info['name']);
     $postValue['price'] = $info['price'];
     $postValue['method'] = 'Mua_ngay';
     $postValue['partnerId'] = $partnerId;
     $signal = $this->encodeSignal($postValue['itemid'] . $postValue['itemdesc'] . $postValue['price'] . $postValue['method'] . '|' . $key);
     $postValue['signal'] = $signal;
     $postValue['param'] = "";
     $return = $nhHttp->post("http://payment.xalo.vn/api", $postValue);
     $result = explode("|", $return[0]);
     return $result;
 }
开发者ID:vuong93st,项目名称:w-game,代码行数:26,代码来源:payment.class.php

示例4: printTicketsHTMLTable

function printTicketsHTMLTable($accounts, $ticketCost, $ticketTime)
{
    $output = "";
    global $ticketInformation;
    global $ticketLogoFile;
    // the $accounts array contain the username,password|| first element as it's originally
    // used to be a for CSV table header
    array_shift($accounts);
    // we align 3 tables for each row (each line)
    // for each 4th entry of a new ticket table we put it in a new row of it's own
    $trCounter = 0;
    foreach ($accounts as $userpass) {
        list($user, $pass) = split(",", $userpass);
        if ($trCounter > 2) {
            $trCounter = 0;
        }
        if ($trCounter == 2) {
            $trTextEnd = "</tr>";
        } else {
            $trTextEnd = "";
        }
        if ($trCounter == 0) {
            $trTextBeg = "<tr>";
        } else {
            $trTextBeg = "";
        }
        $output .= "\n\t\t\t{$trTextBeg}\n\t\t\t\t<td>\n\t\t\t\t\t<table border='1' cellpadding='1' cellspacing='1' height='140' width='211'>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr align='center'>\n\t\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t\t\t<img src='{$ticketLogoFile}' alt='Logo' />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<b>Login</b>: \n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<font size='2'>\n\t\t\t\t\t\t\t\t{$user}\n\t\t\t\t\t\t\t\t</font>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<b>Password</b>:\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<font size='2'>\n\t\t\t\t\t\t\t\t{$pass}\n\t\t\t\t\t\t\t\t</font>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<b>Validity</b>:\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<font size='2'>\n\t\t\t\t\t\t\t\t{$ticketTime}\n\t\t\t\t\t\t\t\t</font>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<b>Price</b>:\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<font size='2'>\n\t\t\t\t\t\t\t\t{$ticketCost}\n\t\t\t\t\t\t\t\t</font>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2' valign='top'>\n\t\t\t\t\t\t\t\t<font size='1'>\n\t\t\t\t\t\t\t\t{$ticketInformation}\n\t\t\t\t\t\t\t\t</font>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t\t\n\t\t\t\t</td>\n\t\t\t{$trTextEnd}\n\t\t";
        $trCounter++;
    }
    print "\n\t\t <style type='text/css'>\n\t\t\t@page { size:landscape; margin-top:20cm; margin-right:0cm; margin-left:0cm; margin-bottom: 0px; marks:cross;}\n\t\t</style>\n\t\t<html><body> \n\t\t\t<table style='maring-top: 15px; margin-left: auto; margin-right: auto;' \n\t\t\t\t\tcellspacing='15'>\n\t\t\t\t<tbody>\n\t\t\t\t\t\t\t{$output}\n\t\t\t\t</tbody>\n\t\t\t</table>\t\n\t\t</body></html>\n\t";
}
开发者ID:fevenor,项目名称:Dockerfile,代码行数:31,代码来源:printTickets.php

示例5: WriteHTML

 function WriteHTML($html)
 {
     //HTML parser
     $html = str_replace("\n", ' ', $html);
     $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
     foreach ($a as $i => $e) {
         if ($i % 2 == 0) {
             //Text
             if ($this->HREF) {
                 $this->PutLink($this->HREF, $e);
             } else {
                 $this->Write(5, $e);
             }
         } else {
             //Tag
             if ($e[0] == '/') {
                 $this->CloseTag(strtoupper(substr($e, 1)));
             } else {
                 //Extract properties
                 $a2 = split(' ', $e);
                 $tag = strtoupper(array_shift($a2));
                 $prop = array();
                 foreach ($a2 as $v) {
                     if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
                         $prop[strtoupper($a3[1])] = $a3[2];
                     }
                 }
                 $this->OpenTag($tag, $prop);
             }
         }
     }
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:32,代码来源:index.php

示例6: quote

 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes;
     if (!$order) {
         $order = new order();
         $shipping_weight = $_SESSION['cart']->show_weight();
     }
     $order_delivery_country = $order->delivery['country'];
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $order_total = $_SESSION['cart']->show_total();
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = split("[:,]", MODULE_SHIPPING_TABLE_COST);
     $size = sizeof($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($order_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = olc_get_tax_rate($this->tax_class, $order_delivery_country['id'], $order->delivery['zone_id']);
     }
     if (olc_not_null($this->icon)) {
         $this->quotes['icon'] = olc_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
开发者ID:BackupTheBerlios,项目名称:ol-commerce-svn,代码行数:33,代码来源:table.php

示例7: open

 function open($database, $host, $user, $password)
 {
     $connect_string = "";
     if (!$database) {
         return 0;
     }
     $host = split(":", $host);
     if ($host[0]) {
         $connect_string .= "host={$host['0']}";
     }
     if (isset($host[1])) {
         $connect_string .= " port={$host['1']}";
     }
     if ($user) {
         $connect_string .= " user={$user} ";
     }
     if ($password) {
         $connect_string .= " password={$password} ";
     }
     $connect_string .= " dbname={$database}";
     $this->connect_id = @pg_Connect($connect_string);
     if ($this->connect_id) {
         @pg_exec($this->connect_id, "SET DateStyle TO 'ISO'");
     }
     return $this->connect_id;
 }
开发者ID:carriercomm,项目名称:xmec,代码行数:26,代码来源:postgresql.php

示例8: isMatch

 public function isMatch($path)
 {
     if ($this->route == $path) {
         return true;
     }
     // Should be split up, filling the params should be done later!
     if ($this->isDynamic) {
         $route = split('/', $this->route);
         $path = split('/', $path);
         if (count($route) == count($path)) {
             $match = true;
             $params = [];
             for ($i = 0; $i < count($route); $i++) {
                 if (strpos($route[$i], ':') !== false) {
                     $params[$route[$i]] = $path[$i];
                 } elseif ($route[$i] != $path[$i]) {
                     $match = false;
                 }
             }
             if ($match) {
                 $this->params = $params;
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:Hinton,项目名称:EITF05,代码行数:27,代码来源:Router.php

示例9: preProcessNode

 function preProcessNode($n)
 {
     /* remove existing poshRDF hooks */
     $n['a']['class'] = isset($n['a']['class']) ? preg_replace('/\\s?rdf\\-(s|p|o|o-xml)/', '', $n['a']['class']) : '';
     if (!isset($n['a']['rel'])) {
         $n['a']['rel'] = '';
     }
     /* inject poshRDF hooks */
     foreach ($this->terms as $term => $infos) {
         if (!in_array('rel', $infos) && $this->hasClass($n, $term) || $this->hasRel($n, $term)) {
             if ($this->v('scope', '', $infos)) {
                 $infos[] = 'p';
             }
             foreach (array('s', 'p', 'o', 'o-xml') as $type) {
                 if (in_array($type, $infos)) {
                     $n['a']['class'] .= ' rdf-' . $type;
                     $n['a']['class'] = preg_replace('/(^|\\s)' . $term . '(\\s|$)/s', '\\1mf-' . $term . '\\2', $n['a']['class']);
                     $n['a']['rel'] = preg_replace('/(^|\\s)' . $term . '(\\s|$)/s', '\\1mf-' . $term . '\\2', $n['a']['rel']);
                 }
             }
         }
     }
     $n['a']['class m'] = split(' ', $n['a']['class']);
     $n['a']['rel m'] = split(' ', $n['a']['rel']);
     return $n;
 }
开发者ID:harbulot,项目名称:foafme,代码行数:26,代码来源:ARC2_MicroformatsExtractor.php

示例10: getTemplateFileName

  function getTemplateFileName () {
    $request = CRM_Utils_System::currentPath();
    if (false !== strpos($request, '..')) {
      die ("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
    }

    $request = split ('/',$request);
    $tplfile = NULL;
    $smarty= CRM_Core_Smarty::singleton( );
    $smarty->assign("options",array());
    if (CRM_Utils_Array::value(2, $request)) {
      $tplfile = _civicrm_api_get_camel_name($request[2]);
      $tplfile = explode('?', $tplfile);
      $tpl = 'dataviz/'.$tplfile[0].'.tpl';
    }
    if (CRM_Utils_Array::value(3, $request)) {
      $r3 = _civicrm_api_get_camel_name($request[3]);
      $smarty->assign("id",$r3);
    }
    if (!$tplfile) {
      $tpl = "CRM/Civizualise/Page/Main.tpl";
    }
    if( !$smarty->template_exists($tpl) ){
      header("Status: 404 Not Found");
      die ("Can't find the requested template file templates/$tpl");
    }
    return $tpl;
  }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:28,代码来源:Main.php

示例11: dnpt

function dnpt($ext_ip, $ext_prefix, $int_prefix)
{
    $debug = false;
    // This is not a complete solution!!!!!!!!!!!!!!!!!!!!!!!!!!
    $ext_prefix = str_replace(":", "", $ext_prefix);
    $int_prefix = str_replace(":", "", $int_prefix);
    // hehe
    $sauce = hexdec(split(":", $ext_ip)[4]);
    $ext_c = icmpChecksum(hex2bin($ext_prefix));
    $int_c = icmpChecksum(hex2bin($int_prefix));
    if ($debug) {
        print_r(unpack('n', $int_c));
    }
    $diff = unpack('n', $ext_c)[1] - unpack('n', $int_c)[1];
    if ($diff < 0) {
        $diff = 0xffff + $diff;
    }
    $diff = $sauce - $diff;
    if ($debug) {
        print bin2hex($ext_c);
        print "\n";
        print bin2hex($int_c);
        print "\n";
        print dechex($diff);
        print "\n";
    }
    $out = split(":", $ext_ip);
    $out[4] = dechex($diff);
    $out = join($out, ":");
    return $out;
}
开发者ID:xil-se,项目名称:Devnull,代码行数:31,代码来源:ipv6_dnpt.php

示例12: _sendPearMail

 private function _sendPearMail($from, $to, $subject, $message)
 {
     require_once 'Xinc/Ini.php';
     try {
         $smtpSettings = Xinc_Ini::getInstance()->get('email_smtp');
     } catch (Exception $e) {
         $smtpSettings = null;
     }
     if ($smtpSettings != null) {
         $mailer = Mail::factory('smtp', $smtpSettings);
     } else {
         $mailer = Mail::factory('mail');
     }
     $recipients = split(',', $to);
     $headers = array();
     if (isset($smtpSettings['localhost'])) {
         $from = str_replace('@localhost', '@' . $smtpSettings['localhost'], $from);
     }
     $headers['From'] = $from;
     $headers['Subject'] = $subject;
     $res = $mailer->send($recipients, $headers, $message);
     if ($res === true) {
         return $res;
     } else {
         return false;
     }
 }
开发者ID:xinc-develop,项目名称:xinc-core,代码行数:27,代码来源:Email.php

示例13: matches

 /**
  * Does the component match the given selector?
  *
  * @param string $c_name    The component name.
  * @param string $c_channel The component channel.
  * @param string $selector  The selector.
  *
  * @return boolen True if the component matches.
  */
 public static function matches($c_name, $c_channel, $selector)
 {
     $selectors = split(',', $selector);
     if (in_array('ALL', $selectors)) {
         return true;
     }
     foreach ($selectors as $selector) {
         if (empty($selector)) {
             continue;
         }
         if (strpos($selector, '/') !== false) {
             list($channel, $name) = split('/', $selector, 2);
             if ($c_channel == $channel && $c_name == $name) {
                 return true;
             }
             continue;
         }
         if (substr($selector, 0, 8) == 'channel:') {
             if ($c_channel == substr($selector, 8)) {
                 return true;
             }
             continue;
         }
         if ($c_name == $selector) {
             return true;
         }
     }
     return false;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:38,代码来源:Match.php

示例14: ascii_j

function ascii_j($p, $o, $res = '')
{
    list($p, $o) = ajxp($res, $p, $o);
    //build
    if ($o) {
        $ret = ascii_arr($o);
        $r = explode(' ', $o);
    } else {
        if ($p) {
            list($start, $length) = split("-", $p);
        } else {
            $start = 128;
            $length = 1000;
        }
        for ($i = $start; $i <= $start + $length; $i++) {
            $r[] = $i;
        }
        $ret .= ascii_menu($start, $length);
    }
    //signs
    foreach ($r as $k => $v) {
        if ($v) {
            $bt .= ljb('', 'insert', $v . ' ', chr_b($v)) . ' ';
        }
    }
    $ret .= divs('font-size:medium; line-height:140%;', $bt);
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:28,代码来源:ascii.php

示例15: returnMacAddress

function returnMacAddress($remoteIp)
{
    exec("/usr/sbin/arp -n", $arpSplitted);
    $ipFound = false;
    // Cicle the array to find the match with the remote ip address
    foreach ($arpSplitted as $value) {
        // Split every arp line, this is done in case the format of the arp
        // command output is a bit different than expected
        $valueSplitted = split(" ", $value);
        foreach ($valueSplitted as $spLine) {
            if (preg_match("/{$remoteIp}/", $spLine)) {
                $ipFound = true;
            }
            // The ip address has been found, now rescan all the string
            // to get the mac address
            if ($ipFound) {
                // Rescan all the string, in case the mac address, in the string
                // returned by arp, comes before the ip address
                reset($valueSplitted);
                foreach ($valueSplitted as $spLine) {
                    $pg = preg_match("/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i", $spLine);
                    if ($pg) {
                        return $spLine;
                    }
                }
            }
            $ipFound = false;
        }
    }
    return false;
}
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:31,代码来源:radius.php


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