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


PHP Key函数代码示例

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


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

示例1: SendMail

 function SendMail($to, $subject, $body, $headers)
 {
     $command = $this->sendmail_path . " -t";
     if (isset($this->delivery["Headers"])) {
         $headers_values = $this->delivery["Headers"];
         for ($return_path = "", $header = 0, Reset($headers_values); $header < count($headers_values); $header++, Next($headers_values)) {
             if (strtolower(Key($headers_values)) == "return-path") {
                 $return_path = $headers_values[Key($headers_values)];
                 break;
             }
         }
         if (strlen($return_path)) {
             $command .= " -f {$return_path}";
         }
     }
     if (strlen($this->sendmail_arguments)) {
         $command .= " " . $this->sendmail_arguments;
     }
     if (!($pipe = popen($command, "w"))) {
         return $this->OutputError("it was not possible to open sendmail input pipe");
     }
     if (!fputs($pipe, "To: {$to}\n") || !fputs($pipe, "Subject: {$subject}\n") || $headers != "" && !fputs($pipe, "{$headers}\n") || !fputs($pipe, "\n{$body}")) {
         return $this->OutputError("it was not possible to write sendmail input pipe");
     }
     pclose($pipe);
     return "";
 }
开发者ID:BackupTheBerlios,项目名称:aligilo-svn,代码行数:27,代码来源:sendmail_message.php

示例2: PageLoad

 function PageLoad(&$form)
 {
     $tv = $this->template_variables;
     $ttv = count($tv);
     for ($t = '', Reset($tv), $v = 0; $v < $ttv; Next($tv), ++$v) {
         $k = Key($tv);
         if ($v > 0) {
             $t .= ',';
         }
         $t .= ' ' . $form->EncodeJavascriptString($k) . ': { preview: ' . $form->EncodeJavascriptString($tv[$k]['Preview']) . ', inline: ' . (isset($tv[$k]['Inline']) && $tv[$k]['Inline'] ? 'true' : 'false') . (isset($tv[$k]['Title']) ? ', title: ' . $form->EncodeJavascriptString($tv[$k]['Title']) : '');
         if (isset($tv[$k]['Alternatives'])) {
             $t .= ', alternatives: {';
             $va = $tv[$k]['Alternatives'];
             $tva = count($va);
             for (Reset($va), $a = 0; $a < $tva; Next($va), ++$a) {
                 $ka = Key($va);
                 if ($a > 0) {
                     $t .= ',';
                 }
                 $t .= ' ' . $form->EncodeJavascriptString($ka) . ': { preview: ' . $form->EncodeJavascriptString($va[$ka]['Preview']) . (isset($va[$ka]['Title']) ? ', title: ' . $form->EncodeJavascriptString($va[$ka]['Title']) : '') . ' }';
             }
             $t .= ' }';
         }
         $t .= ' }';
     }
     $css = $this->external_css;
     $tc = count($css);
     for ($e = '', $c = 0; $c < $tc; ++$c) {
         if ($c > 0) {
             $e .= ',';
         }
         $e .= ' ' . $form->EncodeJavascriptString($css[$c]);
     }
     return 'var e = new ML.HTMLEditor.Editor();' . "\n" . 'e.debug = ' . ($this->debug ? 'true' : 'false') . ';' . (strlen($t) ? ' e.templateVariables = {' . $t . '};' : '') . (strlen($e) ? ' e.externalCSS = [' . $e . '];' : '') . ' e.insertEditor(' . $form->EncodeJavascriptString($this->input) . ', { id: ' . $form->EncodeJavascriptString($this->textarea['ID']) . ', name: ' . $form->EncodeJavascriptString($this->textarea['NAME']) . (isset($this->textarea['VALUE']) ? ', value: ' . $form->EncodeJavascriptString($this->textarea['VALUE']) : '') . (isset($this->textarea['ROWS']) ? ', rows: ' . $form->EncodeJavascriptString($this->textarea['ROWS']) : '') . (isset($this->textarea['COLS']) ? ', cols: ' . $form->EncodeJavascriptString($this->textarea['COLS']) : '') . (isset($this->textarea['STYLE']) ? ', style: ' . $form->EncodeJavascriptString($this->textarea['STYLE']) . (isset($this->textarea['CLASS']) ? ', className: ' . $form->EncodeJavascriptString($this->textarea['CLASS']) : '') : '') . ' });';
 }
开发者ID:wycus,项目名称:darmedic,代码行数:35,代码来源:form_html_editor.php

示例3: ValidateEmailHost

 function ValidateEmailHost($email, $hosts = 0)
 {
     if (!$this->ValidateEmailAddress($email)) {
         return 0;
     }
     //if(strpos(PHP_OS,'WIN') !== false) return(-1);
     $user = strtok($email, "@");
     $domain = strtok("");
     if (getmxrr($domain, &$hosts, &$weights)) {
         $mxhosts = array();
         for ($host = 0; $host < count($hosts); $host++) {
             $mxhosts[$weights[$host]] = $hosts[$host];
         }
         ksort($mxhosts);
         for (reset($mxhosts), $host = 0; $host < count($mxhosts); Next($mxhosts), $host++) {
             $hosts[$host] = $mxhosts[Key($mxhosts)];
         }
     } else {
         $hosts = array();
         if (strcmp(@gethostbyname($domain), $domain) != 0) {
             $hosts[] = $domain;
         }
     }
     return count($hosts) != 0;
 }
开发者ID:TiMoChao,项目名称:xingfu,代码行数:25,代码来源:emailverify.class.php

示例4: CheckRequirements

 function CheckRequirements()
 {
     Reset($this->requirements);
     $end = GetType($function = Key($this->requirements)) != "string";
     for (; !$end;) {
         if (!function_exists($function)) {
             return $this->requirements[$function];
         }
         Next($this->requirements);
         $end = GetType($function = Key($this->requirements)) != "string";
     }
     return "";
 }
开发者ID:wycus,项目名称:darmedic,代码行数:13,代码来源:form_secure_submit.php

示例5: DumpArray

function DumpArray(&$array, $indent)
{
    for (Reset($array), $node = 0; $node < count($array); Next($array), $node++) {
        echo $indent . "\"" . Key($array) . "\"=";
        $value = $array[Key($array)];
        if (GetType($value) == "array") {
            echo "\n" . $indent . "[\n";
            DumpArray($value, $indent . "\t");
            echo $indent . "]\n";
        } else {
            echo "\"{$value}\"\n";
        }
    }
}
开发者ID:sjw-github,项目名称:lib,代码行数:14,代码来源:test_xml_parser.php

示例6: SearchCompleteValues

 function SearchCompleteValues(&$form, $text, &$found)
 {
     if (strlen($text) == 0) {
         $found = $this->complete_values;
     } else {
         $t = strtolower($text);
         for ($found = array(), Reset($this->complete_values), $v = 0; $v < count($this->complete_values); $v++, Next($this->complete_values)) {
             $c = Key($this->complete_values);
             if (!strcmp($t, strtolower(substr($c, 0, strlen($t))))) {
                 $found[$c] = $this->complete_values[$c];
             }
         }
     }
     return '';
 }
开发者ID:wycus,项目名称:darmedic,代码行数:15,代码来源:form_auto_complete.php

示例7: test_quoting

function test_quoting(&$message, $test_values, $cs, $quote, $email_header, &$tests, &$failed)
{
    Reset($test_values);
    $end = GetType($value = Key($test_values)) != "string";
    for (; !$end; $tests++) {
        echo "Test value \"", $value, "\"...";
        flush();
        $encoded = $quote ? $message->QuoteText($value) : $message->QuotedPrintableEncode($value, $cs, 1, $email_header);
        if (strcmp($encoded, $test_values[$value])) {
            echo "\tFAIL: returned \"", $encoded, "\" and not \"", $test_values[$value], "\" as expected!\n";
            $failed++;
        } else {
            echo "\tOK!\n";
        }
        Next($test_values);
        $end = GetType($value = Key($test_values)) != "string";
    }
}
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:18,代码来源:test_quoted_printable.php

示例8: __construct

 public function __construct()
 {
     while (true) {
         $tmp = new test();
         $EID = $this->GetNewEID();
         $this->RunningEvent[$EID] = $tmp;
         unset($tmp);
         echo count($this->RunningEvent) . "\n";
         end($this->RunningEvent);
         do {
             $EID = Key($this->RunningEvent);
             if ($this->RunningEvent[$EID]->dead()) {
                 unset($this->RunningEvent[$EID]);
             }
             $Continue = Prev($this->RunningEvent);
         } while ($Continue != FALSE);
     }
 }
开发者ID:dhawton,项目名称:adria,代码行数:18,代码来源:test.php

示例9: AlterTable

 function AlterTable(&$db, $name, &$changes, $check)
 {
     if ($check) {
         for ($change = 0, Reset($changes); $change < count($changes); Next($changes), $change++) {
             switch (Key($changes)) {
                 case "AddedFields":
                     break;
                 case "RemovedFields":
                     return $db->SetError("Alter table", "database server does not support dropping table columns");
                 case "name":
                 case "RenamedFields":
                 case "ChangedFields":
                 default:
                     return $db->SetError("Alter table", "change type \"" . Key($changes) . "\" not yet supported");
             }
         }
         return 1;
     } else {
         if (isset($changes[$change = "name"]) || isset($changes[$change = "RenamedFields"]) || isset($changes[$change = "ChangedFields"])) {
             return $db->SetError("Alter table", "change type \"{$change}\" not yet supported");
         }
         $query = "";
         if (isset($changes["AddedFields"])) {
             $fields = $changes["AddedFields"];
             for ($field = 0, Reset($fields); $field < count($fields); Next($fields), $field++) {
                 if (!$db->Query("ALTER TABLE {$name} ADD " . $fields[Key($fields)]["Declaration"])) {
                     return 0;
                 }
             }
         }
         if (isset($changes["RemovedFields"])) {
             $fields = $changes["RemovedFields"];
             for ($field = 0, Reset($fields); $field < count($fields); Next($fields), $field++) {
                 if (!$db->Query("ALTER TABLE {$name} DROP " . Key($fields))) {
                     return 0;
                 }
             }
         }
         return 1;
     }
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:41,代码来源:manager_pgsql.php

示例10: CheckRequirements

 function CheckRequirements()
 {
     if (isset($this->requirements["imagegif"]) && strcmp($this->image_format, "gif")) {
         $this->requirements["image" . $this->image_format] = "the GD extension is not able to save in the " . strtoupper($this->image_format) . " format";
         unset($this->requirements["imagegif"]);
     }
     if (isset($this->requirements["imagecreatefromgif"]) && strcmp($this->noise_image_format, "gif")) {
         if (strlen($this->noise_image_format)) {
             $this->requirements["imagecreatefrom" . $this->noise_image_format] = "the GD extension is not able to read image files in the " . strtoupper($this->noise_image_format) . " format";
         }
         unset($this->requirements["imagecreatefromgif"]);
     }
     Reset($this->requirements);
     $end = GetType($function = Key($this->requirements)) != "string";
     for (; !$end;) {
         if (!function_exists($function)) {
             return $this->requirements[$function];
         }
         Next($this->requirements);
         $end = GetType($function = Key($this->requirements)) != "string";
     }
     return "";
 }
开发者ID:wycus,项目名称:darmedic,代码行数:23,代码来源:form_captcha.php

示例11: AlterTable

 function AlterTable(&$db, $name, &$changes, $check)
 {
     if ($check) {
         for ($change = 0, Reset($changes); $change < count($changes); Next($changes), $change++) {
             switch (Key($changes)) {
                 case "AddedFields":
                     break;
                 case "RemovedFields":
                 case "name":
                 case "RenamedFields":
                 case "ChangedFields":
                 default:
                     return $db->SetError("Alter table", "change type \"" . Key($changes) . "\" not yet supported");
             }
         }
         return 1;
     } else {
         if (isset($changes[$change = "RemovedFields"]) || isset($changes[$change = "name"]) || isset($changes[$change = "RenamedFields"]) || isset($changes[$change = "ChangedFields"])) {
             return $db->SetError("Alter table", "change type \"{$change}\" is not supported by the server");
         }
         $query = "";
         if (isset($changes["AddedFields"])) {
             if (strcmp($query, "")) {
                 $query .= ", ";
             }
             $query .= "ADD ";
             $fields = $changes["AddedFields"];
             for ($field = 0, Reset($fields); $field < count($fields); Next($fields), $field++) {
                 if (strcmp($query, "")) {
                     $query .= ", ";
                 }
                 $query .= $fields[Key($fields)]["Declaration"];
             }
         }
         return strcmp($query, "") ? $db->Query("ALTER TABLE {$name} {$query}") : 1;
     }
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:37,代码来源:manager_mssql.php

示例12: ValidateEmailHost

 function ValidateEmailHost($email, $hosts = 0)
 {
     if (!$this->ValidateEmailAddress($email)) {
         return 0;
     }
     $user = strtok($email, "@");
     $domain = strtok("");
     if (GetMXRR($domain, &$hosts, &$weights)) {
         $mxhosts = array();
         for ($host = 0; $host < count($hosts); $host++) {
             $mxhosts[$weights[$host]] = $hosts[$host];
         }
         KSort($mxhosts);
         for (Reset($mxhosts), $host = 0; $host < count($mxhosts); Next($mxhosts), $host++) {
             $hosts[$host] = $mxhosts[Key($mxhosts)];
         }
     } else {
         $hosts = array();
         if (strcmp(@gethostbyname($domain), $domain) != 0) {
             $hosts[] = $domain;
         }
     }
     return count($hosts) != 0;
 }
开发者ID:Pengzw,项目名称:c3crm,代码行数:24,代码来源:email_validation.php

示例13: CreateIndex

 function CreateIndex(&$db, $table, $name, &$definition)
 {
     $query = "CREATE " . (isset($definition["unique"]) ? "UNIQUE" : "") . " INDEX {$name} ON {$table} (";
     for ($field = 0, Reset($definition["FIELDS"]); $field < count($definition["FIELDS"]); $field++, Next($definition["FIELDS"])) {
         if ($field > 0) {
             $query .= ",";
         }
         $query .= Key($definition["FIELDS"]);
     }
     $query .= ")";
     return $db->Query($query);
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:12,代码来源:manager_sqlite.php

示例14: OpenMailing

 function OpenMailing(&$mailing, &$mailing_properties)
 {
     if (strlen($this->error)) {
         return $this->error;
     }
     if (!isset($mailing_properties["Name"]) || strlen($mailing_properties["Name"]) == 0) {
         return $this->OutputError("it was not specified a valid mailing Name");
     }
     if (!isset($mailing_properties["Return-Path"]) || strlen($mailing_properties["Return-Path"]) == 0) {
         return $this->OutputError("it was not specified a valid mailing Return-Path");
     }
     $separator = "";
     $directory_separator = defined("DIRECTORY_SEPARATOR") ? DIRECTORY_SEPARATOR : (defined("PHP_OS") && !strcmp(substr(PHP_OS, 0, 3), "WIN") ? "\\" : "/");
     $length = strlen($this->mailing_path);
     if ($length) {
         if ($this->mailing_path[$length - 1] != $directory_separator) {
             $separator = $directory_separator;
         }
     }
     $base_path = $this->mailing_path . $separator . $mailing_properties["Name"];
     if ($this->body_parts == 0) {
         return $this->OutputError("message has no body parts");
     }
     $line_break = "\n";
     $headers = $this->headers;
     if (strlen($this->mailer)) {
         $headers["X-Mailer"] = $this->mailer;
     }
     $headers["MIME-Version"] = "1.0";
     if (strlen($error = $this->GetPartHeaders($headers, $this->body))) {
         return $error;
     }
     if (!($header_file = @fopen($base_path . ".h", "wb"))) {
         return $this->OutputPHPError("could not open mailing headers file " . $base_path . ".h", $php_errormsg);
     }
     for ($header = 0, Reset($headers); $header < count($headers); Next($headers), ++$header) {
         $header_name = Key($headers);
         if (!@fwrite($header_file, $header_name . ": " . $headers[$header_name] . $line_break)) {
             fclose($header_file);
             return $this->OutputPHPError("could not write to the mailing headers file " . $base_path . ".h", $php_errormsg);
         }
     }
     if (!@fflush($header_file)) {
         fclose($header_file);
         @unlink($base_path . ".h");
         return $this->OutputPHPError("could not write to the mailing headers file " . $base_path . ".h", $php_errormsg);
     }
     fclose($header_file);
     if (strlen($error = $this->GetPartBody($body, $this->body))) {
         @unlink($base_path . ".h");
         return $error;
     }
     if (!($body_file = @fopen($base_path . ".b", "wb"))) {
         @unlink($base_path . ".h");
         return $this->OutputPHPError("could not open mailing body file " . $base_path . ".b", $php_errormsg);
     }
     if (!@fwrite($body_file, $body) || !@fflush($body_file)) {
         fclose($body_file);
         @unlink($base_path . ".b");
         @unlink($base_path . ".h");
         return $this->OutputPHPError("could not write to the mailing body file " . $base_path . ".b", $php_errormsg);
     }
     fclose($body_file);
     if (!($envelope = @fopen($base_path . ".e", "wb"))) {
         @unlink($base_path . ".b");
         @unlink($base_path . ".h");
         return $this->OutputPHPError("could not open mailing envelope file " . $base_path . ".e", $php_errormsg);
     }
     if (!@fwrite($envelope, "F" . $mailing_properties["Return-Path"] . chr(0)) || !@fflush($envelope)) {
         @fclose($envelope);
         @unlink($base_path . ".e");
         @unlink($base_path . ".b");
         @unlink($base_path . ".h");
         return $this->OutputPHPError("could not write to the return path to the mailing envelope file " . $base_path . ".e", $php_errormsg);
     }
     $mailing = ++$this->last_mailing;
     $this->mailings[$mailing] = array("Envelope" => $envelope, "BasePath" => $base_path);
     return "";
 }
开发者ID:aydancoskun,项目名称:octobercms,代码行数:79,代码来源:email_message.php

示例15: FetchResultArray

 function FetchResultArray($result, &$array, $row)
 {
     $result_value = intval($result);
     if (!$this->FetchRow($result, $row) || !isset($this->columns[$result_value]) && !$this->GetColumnNames($result)) {
         return 0;
     }
     for ($array = array(), Reset($this->results[$result_value][$row]); $field = Key($this->results[$result_value][$row]); Next($this->results[$result_value][$row])) {
         $array[$this->columns[$result_value][$field]] = $this->results[$result_value][$row][$field];
     }
     $this->highest_fetched_row[$result_value] = max($this->highest_fetched_row[$result_value], $row);
     return $this->ConvertResultRow($result, $array);
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:12,代码来源:metabase_ifx.php


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