当前位置: 首页>>代码示例>>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;未经允许,请勿转载。