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


PHP each函数代码示例

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


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

示例1: getSignVeryfy

 /**
  * 获取返回时的签名验证结果
  * @param $para_temp 通知返回来的参数数组
  * @param $sign 返回的签名结果
  * @return 签名验证结果
  */
 protected function getSignVeryfy($param, $sign)
 {
     //除去待签名参数数组中的空值和签名参数
     $param_filter = array();
     while (list($key, $val) = each($param)) {
         if ($key == "sign" || $key == "sign_type" || $val == "") {
             continue;
         } else {
             $param_filter[$key] = $param[$key];
         }
     }
     ksort($param_filter);
     reset($param_filter);
     //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
     $prestr = "";
     while (list($key, $val) = each($param_filter)) {
         $prestr .= $key . "=" . $val . "&";
     }
     //去掉最后一个&字符
     $prestr = substr($prestr, 0, -1);
     $prestr = $prestr . $this->config['key'];
     $mysgin = md5($prestr);
     if ($mysgin == $sign) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:lizhug,项目名称:thinkunit,代码行数:34,代码来源:Alipay.class.php

示例2: sanitize_uri

function sanitize_uri()
{
    global $PATH_INFO, $SCRIPT_NAME, $REQUEST_URI;
    if (isset($PATH_INFO) && $PATH_INFO != "") {
        $SCRIPT_NAME = $PATH_INFO;
        $REQUEST_URI = "";
    }
    if ($REQUEST_URI == "") {
        //necessary for some IIS installations (CGI in particular)
        $get = httpallget();
        if (count($get) > 0) {
            $REQUEST_URI = $SCRIPT_NAME . "?";
            reset($get);
            $i = 0;
            while (list($key, $val) = each($get)) {
                if ($i > 0) {
                    $REQUEST_URI .= "&";
                }
                $REQUEST_URI .= "{$key}=" . URLEncode($val);
                $i++;
            }
        } else {
            $REQUEST_URI = $SCRIPT_NAME;
        }
        $_SERVER['REQUEST_URI'] = $REQUEST_URI;
    }
    $SCRIPT_NAME = substr($SCRIPT_NAME, strrpos($SCRIPT_NAME, "/") + 1);
    if (strpos($REQUEST_URI, "?")) {
        $REQUEST_URI = $SCRIPT_NAME . substr($REQUEST_URI, strpos($REQUEST_URI, "?"));
    } else {
        $REQUEST_URI = $SCRIPT_NAME;
    }
}
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:33,代码来源:php_generic_environment.php

示例3: next

 function next()
 {
     list($this->key, $this->current) = each($this->array);
     //		list($key, $current) = each($this->array);
     //		$this->key = $key;
     //		$this->current = $current;
 }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:7,代码来源:iterators_006.php

示例4: run

 public function run($args)
 {
     global $connect, $dbprefix;
     $field = $args[0];
     $srid = $_SESSION['srid'];
     $sid = $_POST['sid'];
     $query = "SELECT {$field} FROM {$dbprefix}survey_{$sid} WHERE id = {$srid}";
     if (!($result = $connect->Execute($query))) {
         throw new Exception("Couldn't get question '{$field}' answer<br />" . $connect->ErrorMsg());
         //Checked
     }
     $row = $result->fetchRow();
     $value = $row[$field];
     $found = array_keys($args, $value);
     if (count($found)) {
         while ($e = each($found)) {
             if ($e['value'] % 2 != 0) {
                 // we check this, as only at odd indexes there are 'cases'
                 return $args[$e['value'] + 1];
             }
         }
         // returns value associated with found 'case'
     }
     // return empty string if none of cases matches user's answer
     return "";
 }
开发者ID:himanshu12k,项目名称:ce-www,代码行数:26,代码来源:dFunctionSwitch.php

示例5: dataInsert

 function dataInsert($table, $dataArray)
 {
     $fldArray = $dataArray;
     $i = 0;
     $j = 0;
     $sql .= "insert into `" . $table . "` (";
     while (list($key1, $value1) = each($fldArray)) {
         $sql .= "`" . $key1 . "`";
         $j++;
         if ($j != count($fldArray)) {
             $sql .= ",";
         }
         if ($j == count($fldArray)) {
             $sql .= ") VALUES (";
         }
     }
     while (list($key1, $value1) = each($dataArray)) {
         $sql .= "'" . $value1 . "'";
         $i++;
         if ($i != count($dataArray)) {
             $sql .= ",";
         }
         if ($i == count($dataArray)) {
             $sql .= ")";
         }
     }
     mysql_query($sql) or die(CHECK_QUERY . $sql);
     $id = mysql_insert_id();
     return $id;
 }
开发者ID:mix376,项目名称:biverr,代码行数:30,代码来源:db_recommend.php

示例6: nextMail

 /**
  * {@inheritdoc}
  */
 public function nextMail()
 {
     // Get the current mail spool row and update the internal pointer to the
     // next row.
     $return = each($this->mails);
     // If we're done, return false.
     if (!$return) {
         return FALSE;
     }
     $spool_data = $return['value'];
     // Store this spool row as processed.
     $this->processed[$spool_data->msid] = $spool_data;
     $entity = entity_load($spool_data->entity_type, $spool_data->entity_id);
     if (!$entity) {
         // If the entity load failed, set the processed status done and proceed with
         // the next mail.
         $this->processed[$spool_data->msid]->result = array('status' => SpoolStorageInterface::STATUS_DONE, 'error' => TRUE);
         return $this->nextMail();
     }
     if ($spool_data->data) {
         $subscriber = $spool_data->data;
     } else {
         $subscriber = simplenews_subscriber_load_by_mail($spool_data->mail);
     }
     if (!$subscriber) {
         // If loading the subscriber failed, set the processed status done and
         // proceed with the next mail.
         $this->processed[$spool_data->msid]->result = array('status' => SpoolStorageInterface::STATUS_DONE, 'error' => TRUE);
         return $this->nextMail();
     }
     $mail = new MailEntity($entity, $subscriber, \Drupal::service('simplenews.mail_cache'));
     // Set the langcode langcode.
     $this->processed[$spool_data->msid]->langcode = $mail->getEntity()->language()->getId();
     return $mail;
 }
开发者ID:aritnath1990,项目名称:simplenewslatest,代码行数:38,代码来源:SpoolList.php

示例7: populateData

 public function populateData($search = false)
 {
     $tahun = $_SESSION['ta'];
     $dataobat = $_SESSION['currentPagePerpetualStock']['dataobat'];
     $idobat = $dataobat['idobat'];
     $str = "SELECT ks.idobat,ks.tanggal,ks.qty,dsb.idsatuan_obat AS pembelian_idsatuan,dsb.harga AS pembelian_harga,dsb.harga*ks.qty AS pembelian_jumlah,dsk.idsatuan_obat AS pengeluaran_idsatuan,dsk.harga AS pengeluaran_harga,dsk.harga*ks.qty AS pengeluaran_jumlah,ks.sisa_stock,ks.mode,ks.keterangan,ks.date_added FROM log_ks ks LEFT JOIN detail_sbbm dsb ON (ks.iddetail_sbbm=dsb.iddetail_sbbm) LEFT JOIN detail_sbbk dsk ON (ks.iddetail_sbbk=dsk.iddetail_sbbk) WHERE ks.idobat={$idobat} AND ks.tahun={$tahun} ORDER BY ks.date_added ASC";
     $this->DB->setFieldTable(array('idobat', 'tanggal', 'qty', 'pembelian_idsatuan', 'pembelian_harga', 'pembelian_jumlah', 'pengeluaran_idsatuan', 'pengeluaran_harga', 'pengeluaran_jumlah', 'sisa_stock', 'mode', 'keterangan'));
     $r = $this->DB->getRecord($str);
     $data = array();
     while (list($k, $v) = each($r)) {
         if ($v['mode'] == 'masuk') {
             $v['nama_satuan'] = $this->DMaster->getNamaSatuanObat($v['pembelian_idsatuan']);
             $v['uraian'] = $v['keterangan'];
             $v['harga'] = $v['pembelian_harga'];
             $v['pembelian_qty'] = $v['qty'];
             $v['saldo_jumlah'] = $v['harga'] * $v['sisa_stock'];
             $v['pengeluaran_qty'] = '-';
             $v['pengeluaran_jumlah'] = '-';
         } else {
             $v['nama_satuan'] = $this->DMaster->getNamaSatuanObat($v['pengeluaran_idsatuan']);
             $v['uraian'] = $v['keterangan'];
             $v['harga'] = $v['pengeluaran_harga'];
             $v['pengeluaran_qty'] = $v['qty'];
             $v['saldo_jumlah'] = $v['harga'] * $v['sisa_stock'];
             $v['pembelian_qty'] = '-';
             $v['pembelian_jumlah'] = '-';
         }
         $data[$k] = $v;
     }
     $this->RepeaterS->DataSource = $data;
     $this->RepeaterS->dataBind();
 }
开发者ID:silotester,项目名称:silo,代码行数:32,代码来源:PerpetualStock.php

示例8: foot

    function foot($buttons = '')
    {
        if ($buttons) {
            if (!is_array($buttons)) {
                $tmp = $buttons;
                $buttons = array();
                $buttons[$tmp] = $tmp;
            }
            ?>
				<tr>
					<td align="right">&nbsp;</td>
					<td align="left">
				<?php 
            reset($buttons);
            while (list($name, $value) = each($buttons)) {
                ?>
					<input type="submit" name="<?php 
                echo $name;
                ?>
" value=" <?php 
                echo $value;
                ?>
 " />&nbsp;&nbsp;
					<?php 
            }
            ?>
					</td>
				</tr>
				<?php 
        }
        ?>
			</table>
			<?php 
    }
开发者ID:hunter2814,项目名称:reason_package,代码行数:34,代码来源:test_box.php

示例9: tabs

function tabs()
{
    $tpl = new templates();
    $array["index"] = '{parameters}';
    $array["rules"] = '{rules}';
    $array["transparent"] = '{transparent_rules}';
    $array["events"] = '{events}';
    //$array["plugins"]='{squid_plugins}';
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $style = "style='font-size:22px'";
    $t = time();
    while (list($num, $ligne) = each($array)) {
        if ($num == "index") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "events") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.events.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "rules") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.rules.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "transparent") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"ss5.transparent.php\" {$style}><span>{$ligne}</span></a></li>\n");
            continue;
        }
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\" {$style}><span>{$ligne}</span></a></li>\n");
    }
    echo build_artica_tabs($html, "ss5_main", 1490);
}
开发者ID:articatech,项目名称:artica,代码行数:34,代码来源:ss5.index.php

示例10: postparse

function postparse($verify = false, $subval = false)
{
    if ($subval) {
        $var = $_POST[$subval];
    } else {
        $var = $_POST;
    }
    reset($var);
    $sql = "";
    $keys = "";
    $vals = "";
    $i = 0;
    while (list($key, $val) = each($var)) {
        if ($verify === false || isset($verify[$key])) {
            if (is_array($val)) {
                $val = addslashes(serialize($val));
            }
            $sql .= ($i > 0 ? "," : "") . "{$key}='{$val}'";
            $keys .= ($i > 0 ? "," : "") . "{$key}";
            $vals .= ($i > 0 ? "," : "") . "'{$val}'";
            $i++;
        }
    }
    return array($sql, $keys, $vals);
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:25,代码来源:http.php

示例11: show_screen

 function show_screen($db_object, $common, $user_id, $default, $post_var)
 {
     while (list($kk, $vv) = @each($post_var)) {
         ${$kk} = $vv;
     }
     $xPath = $common->path;
     $returncontent = $xPath . "/templates/career/careergoals_usage.html";
     $returncontent = $common->return_file_content($db_object, $returncontent);
     $family = $common->prefix_table('family');
     $career_goals = $common->prefix_table('career_goals');
     $mysql = "select family_id,family_name from {$family}";
     $family_arr = $db_object->get_rsltset($mysql);
     preg_match("/<{careergoals_loopstart}>(.*?)<{careergoals_loopend}>/s", $returncontent, $matchold);
     $matchnew = $matchold[1];
     for ($i = 0; $i < count($family_arr); $i++) {
         $family_name = $family_arr[$i]['family_name'];
         $family_id = $family_arr[$i]['family_id'];
         $mysql = "select count(*) as cnt_fam from career_goals where \n\t\t\t(onelevel_low = '{$family_id}' or same_level = '{$family_id}' or onelevel_up = '{$family_id}' or twolevel_up = '{$family_id}')";
         $fam_cnt_arr = $db_object->get_a_line($mysql);
         $fam_cnt = $fam_cnt_arr['cnt_fam'];
         $str .= preg_replace("/<{(.*?)}>/e", "\$\$1", $matchnew);
     }
     $returncontent = preg_replace("/<{careergoals_loopstart}>(.*?)<{careergoals_loopend}>/s", $str, $returncontent);
     $returncontent = $common->direct_replace($db_object, $returncontent, $values);
     echo $returncontent;
 }
开发者ID:nloadholtes,项目名称:people-prodigy,代码行数:26,代码来源:careergoals_usage.php

示例12: index

 function index($values = 0)
 {
     //echo "<p>notes.ui.index: values = "; _debug_array($values);
     if (!is_array($values)) {
         $values = array('nm' => $this->session_data);
     }
     if ($values['add'] || $values['cats'] || isset($values['nm']['rows'])) {
         $this->session_data = $values['nm'];
         unset($this->session_data['rows']);
         $this->save_sessiondata();
         if ($values['add']) {
             return $this->edit();
         } elseif ($values['cats']) {
             Header('Location: ' . $GLOBALS['phpgw']->link('/index.php?menuaction=preferences.uicategories.index&cats_app=et_notes&cats_level=True&global_cats=True'));
             $GLOBALS['phpgw']->common->phpgw_exit();
         } elseif (isset($values['nm']['rows']['view'])) {
             list($id) = each($values['nm']['rows']['view']);
             return $this->view($id);
         } elseif (isset($values['nm']['rows']['edit'])) {
             list($id) = each($values['nm']['rows']['edit']);
             return $this->edit($id);
         } elseif (isset($values['nm']['rows']['delete'])) {
             list($id) = each($values['nm']['rows']['delete']);
             return $this->delete($id);
         }
     }
     $this->tpl->read('et_notes.index');
     $values['nm']['options-filter'] = array('all' => 'Show all', 'public' => 'Only yours', 'private' => 'Private');
     $values['nm']['get_rows'] = 'et_notes.bo.get_rows';
     $values['nm']['no_filter2'] = True;
     $values['user'] = $GLOBALS['phpgw_info']['user']['fullname'];
     $this->tpl->exec('et_notes.ui.index', $values);
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:33,代码来源:class.ui.inc.php

示例13: format

 public function format($source)
 {
     $this->tkns = token_get_all($source);
     $this->code = '';
     while (list($index, $token) = each($this->tkns)) {
         list($id, $text) = $this->getToken($token);
         $this->ptr = $index;
         if (T_WHITESPACE == $id || T_VARIABLE == $id || T_INLINE_HTML == $id || T_COMMENT == $id || T_DOC_COMMENT == $id || T_CONSTANT_ENCAPSED_STRING == $id) {
             $this->appendCode($text);
             continue;
         }
         if (T_STRING == $id && $this->leftUsefulTokenIs([T_DOUBLE_COLON, T_OBJECT_OPERATOR])) {
             $this->appendCode($text);
             continue;
         }
         if (T_START_HEREDOC == $id) {
             $this->appendCode($text);
             $this->printUntil(ST_SEMI_COLON);
             continue;
         }
         if (ST_QUOTE == $id) {
             $this->appendCode($text);
             $this->printUntilTheEndOfString();
             continue;
         }
         $lcText = strtolower($text);
         if (('true' === $lcText || 'false' === $lcText || 'null' === $lcText) && !$this->leftUsefulTokenIs([T_NS_SEPARATOR, T_AS, T_CLASS, T_EXTENDS, T_IMPLEMENTS, T_INSTANCEOF, T_INTERFACE, T_NEW, T_NS_SEPARATOR, T_PAAMAYIM_NEKUDOTAYIM, T_USE, T_TRAIT, T_INSTEADOF, T_CONST]) && !$this->rightUsefulTokenIs([T_NS_SEPARATOR, T_AS, T_CLASS, T_EXTENDS, T_IMPLEMENTS, T_INSTANCEOF, T_INTERFACE, T_NEW, T_NS_SEPARATOR, T_PAAMAYIM_NEKUDOTAYIM, T_USE, T_TRAIT, T_INSTEADOF, T_CONST]) || isset(static::$reservedWords[$lcText])) {
             $text = $lcText;
         }
         $this->appendCode($text);
     }
     return $this->code;
 }
开发者ID:Recras,项目名称:php.tools,代码行数:33,代码来源:PSR2KeywordsLowerCase.php

示例14: PageFetchmail_status

function PageFetchmail_status()
{
    include_once 'ressources/class.fetchmail.inc';
    $tpl = new templates();
    $yum = new usersMenus();
    if ($yum->AsMailBoxAdministrator == false) {
        $html = $tpl->_ENGINE_parse_body("<h3>{not allowed}</H3>");
        return $html;
    }
    $status = new status(1);
    $stat = $status->fetchmail_satus();
    $html = $stat;
    if ($usersmenus->AutomaticConfig == false) {
        $html = $html . "<br><fieldset><legend>{apply config}</legend>\n\t\t\t\t\t<center><input type='button' value='{apply config}' OnClick=\"javascript:TreeFetchMailApplyConfig()\"></center>\n\t\t\t\t</fieldset>";
    }
    $fetch = new fetchmail();
    if (is_array($fetch->array_servers)) {
        $html = $html . "<fieldset>\n\t\t\t\t<legend>{servers_list}</legend>\n\t\t\t\t<center>\n\t\t\t\t<table style='width:90%;border:1px solid #CCCCCC'>\n\t\t\t\t<tr style='border-bottom:1px solid #CCCCCC'>\n\t\t\t\t\t<td colspan=2><strong>{servers_list}</td>\n\t\t\t\t\t<td align='center'><strong>{number_users}</strong></td>\n\t\t\t\t</tr>";
        while (list($num, $val) = each($fetch->array_servers)) {
            $html = $html . "<tr>\n\t\t\t\t\t<td width=1%><img src='img/webmin_on-22.gif'></td>\n\t\t\t\t\t<td><a href=\"javascript:TreeFetchmailShowServer('{$num}');\">{$num}</a></td>\n\t\t\t\t\t<td align='center'>" . count($val) . "</td>\n\t\t\t\t\t</tr>";
        }
        $html = $html . "</table></center></fieldset>";
    }
    return $tpl->_ENGINE_parse_body("<div id=status>{$html}</div>");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:25,代码来源:fetchmail.status.php

示例15: createFromNative

 /**
  * Factory method that constructs the appropriate XML-RPC encoded type value
  *
  * @param mixed Value to be encode
  * @param string Explicit XML-RPC type as enumerated in the XML-RPC spec (defaults to automatically selected type)
  * @return mixed The encoded value
  */
 public static function createFromNative($value, $explicitType)
 {
     $type = strtolower($explicitType);
     $availableTypes = array('datetime', 'base64', 'struct');
     if (in_array($type, $availableTypes)) {
         if ($type == 'struct') {
             if (!is_array($value)) {
                 throw new XML_RPC2_Exception('With struct type, value has to be an array');
             }
             // Because of http://bugs.php.net/bug.php?id=21949
             // is some cases (structs with numeric indexes), we need to be able to force the "struct" type
             // (xmlrpc_set_type doesn't help for this, so we need this ugly hack)
             $new = array();
             while (list($k, $v) = each($value)) {
                 $new["xml_rpc2_ugly_struct_hack_{$k}"] = $v;
                 // with this "string" prefix, we are sure that the array will be seen as a "struct"
             }
             return $new;
         }
         $value2 = (string) $value;
         if (!xmlrpc_set_type($value2, $type)) {
             throw new XML_RPC2_Exception('Error returned from xmlrpc_set_type');
         }
         return $value2;
     }
     return $value;
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:34,代码来源:Value.php


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