當前位置: 首頁>>代碼示例>>PHP>>正文


PHP str_replace_array函數代碼示例

本文整理匯總了PHP中str_replace_array函數的典型用法代碼示例。如果您正苦於以下問題:PHP str_replace_array函數的具體用法?PHP str_replace_array怎麽用?PHP str_replace_array使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了str_replace_array函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: round

         } else {
             $disk_percent = 0;
             $disk_doublepercent = 0;
         }
         if ($row['traffic'] > 0) {
             $traffic_percent = round($row['traffic_used'] * 100 / $row['traffic'], 0);
             $traffic_doublepercent = round($traffic_percent * 2, 2);
         } else {
             $traffic_percent = 0;
             $traffic_doublepercent = 0;
         }
         $islocked = 0;
         if ($row['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $row['lastlogin_fail'] > time() - Settings::Get('login.deactivatetime')) {
             $islocked = 1;
         }
         $row = str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps tickets subdomains');
         $row = htmlentities_array($row);
         // fix progress-bars if value is >100%
         if ($disk_percent > 100) {
             $disk_percent = 100;
         }
         if ($traffic_percent > 100) {
             $traffic_percent = 100;
         }
         $row['custom_notes'] = $row['custom_notes'] != '' ? nl2br($row['custom_notes']) : '';
         eval("\$customers.=\"" . getTemplate("customers/customers_customer") . "\";");
         $count++;
     }
     $i++;
 }
 $customercount = $num_rows;
開發者ID:mowamed,項目名稱:Froxlor,代碼行數:31,代碼來源:admin_customers.php

示例2: formatMessage

 /**
  * 格式化sql錯誤信息
  *
  * @param  string  $sql
  * @param  array  $bindings
  * @param  \Exception $previous
  * @return string
  */
 protected function formatMessage($sql, $bindings, $previous)
 {
     return $previous->getMessage() . ' (SQL: ' . str_replace_array('\\?', $bindings, $sql) . ')';
 }
開發者ID:yb199478,項目名稱:framework,代碼行數:12,代碼來源:QueryException.php

示例3: array

    $domainArray = array();
    while ($row = $db->fetch_array($result)) {
        $domainArray[] = $idna_convert->decode($row['domain']);
    }
    natsort($domainArray);
    $domains = implode(', ', $domainArray);
    $userinfo['email'] = $idna_convert->decode($userinfo['email']);
    $yesterday = time() - 60 * 60 * 24;
    $month = date('M Y', $yesterday);
    /*		$traffic=$db->query_first("SELECT SUM(http) AS http_sum, SUM(ftp_up) AS ftp_up_sum, SUM(ftp_down) AS ftp_down_sum, SUM(mail) AS mail_sum FROM ".TABLE_PANEL_TRAFFIC." WHERE year='".date('Y')."' AND month='".date('m')."' AND day<='".date('d')."' AND customerid='".$userinfo['customerid']."'");
    		$userinfo['traffic_used']=$traffic['http_sum']+$traffic['ftp_up_sum']+$traffic['ftp_down_sum']+$traffic['mail_sum'];*/
    $userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
    $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
    $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
    $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
    $userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains aps_packages');
    $opentickets = 0;
    $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
                                   WHERE `customerid` = "' . $userinfo['customerid'] . '"
                                   AND `answerto` = "0"
                                   AND (`status` = "0" OR `status` = "2")
                                   AND `lastreplier`="1"');
    $awaitingtickets = $opentickets['count'];
    $awaitingtickets_text = '';
    if ($opentickets > 0) {
        $awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="customer_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
    }
    eval("echo \"" . getTemplate("index/index") . "\";");
} elseif ($page == 'change_password') {
    if (isset($_POST['send']) && $_POST['send'] == 'send') {
        $old_password = validate($_POST['old_password'], 'old password');
開發者ID:HobbyNToys,項目名稱:SysCP,代碼行數:31,代碼來源:customer_index.php

示例4: putIdsInPayload

 /**
  * @inheritdoc
  */
 public function putIdsInPayload($payload, array $ids, $randomIdString = '"{random_id}"')
 {
     return str_replace_array($randomIdString, $ids, $payload);
 }
開發者ID:larapackage,項目名稱:randomid,代碼行數:7,代碼來源:Helper.php

示例5: round

             // For Traffic usage
             if ($row['traffic'] > 0) {
                 $traffic_percent = round($row['traffic_used'] * 100 / $row['traffic'], 0);
                 $traffic_doublepercent = round($traffic_percent * 2, 2);
             } else {
                 $traffic_percent = 0;
                 $traffic_doublepercent = 0;
             }
             // fix progress-bars if value is >100%
             if ($disk_percent > 100) {
                 $disk_percent = 100;
             }
             if ($traffic_percent > 100) {
                 $traffic_percent = 100;
             }
             $row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains tickets');
             $row = htmlentities_array($row);
             $row['custom_notes'] = $row['custom_notes'] != '' ? nl2br($row['custom_notes']) : '';
             eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";");
             $count++;
         }
         $i++;
     }
     $admincount = $numrows_admins;
     eval("echo \"" . getTemplate("admins/admins") . "\";");
 } elseif ($action == 'su') {
     $result_stmt = Database::prepare("\n\t\t\tSELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :adminid\n\t\t");
     $result = Database::pexecute_first($result_stmt, array('adminid' => $id));
     $destination_admin = $result['loginname'];
     if ($destination_admin != '' && $result['adminid'] != $userinfo['userid']) {
         $result_stmt = Database::prepare("\n\t\t\t\tSELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = :userid\n\t\t\t");
開發者ID:asemen,項目名稱:Froxlor,代碼行數:31,代碼來源:admin_admins.php

示例6: bindParameters

 /**
  * Bind parameters to a query.
  *
  * @param  string  $query
  * @param  array  $bindings
  * @return string
  */
 protected function bindParameters($query, array $bindings)
 {
     $database = $this->query;
     array_walk($bindings, function (&$binding) use($database) {
         $binding = is_integer($binding) ? (int) $binding : $database->connection()->getPdo()->quote($binding);
     });
     return str_replace_array('\\?', $bindings, $query);
 }
開發者ID:apolune,項目名稱:core,代碼行數:15,代碼來源:TriggerHandler.php


注:本文中的str_replace_array函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。