• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP trimSpaces函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getTimeFromString

 static function getTimeFromString($line)
 {
     ///2006-03-10 07:00:01
     $line = trimSpaces($line);
     $list = explode(" ", $line);
     return $list[0];
 }
开发者ID:digideskio,项目名称:hypervm,代码行数:7,代码来源:vpstraffic__xenlib.php


示例2: readProcessList

 static function readProcessList()
 {
     $list = lscandir("/proc");
     foreach ($list as $pid) {
         if (is_numeric($pid) && $pid[0] != ".") {
             $cmdlinearr = lfile("/proc/" . $pid . "/cmdline");
             $return[$pid]['nname'] = $pid;
             if (!$cmdlinearr) {
                 unset($return[$pid]);
                 continue;
             }
             $cmdline = $cmdlinearr[0];
             $cmdline = preg_replace('+\\0+i', " ", $cmdline);
             $return[$pid]["command"] = substr($cmdline, 0, 100);
             if (csa($cmdline, "display.php") && csa($cmdline, "kloxo")) {
                 unset($return[$pid]);
                 continue;
             }
             $arr = lfile("/proc/" . $return[$pid]["nname"] . "/status");
             foreach ($arr as $a) {
                 if (csb($a, "State:")) {
                     $a = trim($a);
                     $a = strtil($a, "(");
                     $a = strfrom($a, "State:");
                     $a = trim($a);
                     $return[$pid]["state"] = $a;
                     $return[$pid]["state"] = $return[$pid]["state"] === "S" ? "ZZ" : $return[$pid]["state"];
                 }
                 if (csa($a, "Uid")) {
                     $uidarr = explode(":", $a);
                     $value = trimSpaces($uidarr[1]);
                     $uidarr2 = explode(" ", $value);
                     $uid = trim($uidarr2[1]);
                     $pwd = posix_getpwuid($uid);
                     $username = $pwd['name'];
                     $return[$pid]["username"] = $username;
                 }
                 if (csa($a, "VmSize")) {
                     $uidarr = explode(":", $a);
                     $uidarr = trimSpaces($uidarr[1]);
                     $uidarr = strtilfirst($uidarr, " ");
                     $return[$pid]['memory'] = round($uidarr / 1024, 2);
                 }
             }
         }
     }
     return $return;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:48,代码来源:process__linuxlib.php


示例3: getPackages

 static function getPackages($nocache = false)
 {
     $cmd = self::getYumCommand();
     $file = fix_nname_to_be_variable(implode(" ", $cmd));
     $file = "__path_program_root/cache/{$file}";
     if ($nocache) {
         $val = `{$cmd}`;
     } else {
         $val = get_with_cache($file, $cmd);
     }
     $list = explode("\n", $val);
     dprintr($list);
     $match = false;
     $res = null;
     foreach ($list as $l) {
         $l = trim($l);
         if (strstr($l, "---------------------")) {
             $match = true;
             continue;
         }
         if ($match) {
             if (!$l) {
                 break;
             }
         }
         if (!$match) {
             continue;
         }
         $l = trimSpaces($l);
         $l = trim($l);
         if (!$l) {
             continue;
         }
         $v = explode(" ", $l);
         $out['nname'] = $v[0];
         //$out['arch'] = $v[1];
         $out['update_version'] = $v[1];
         $out['kloxo_status'] = 'dull';
         if ($v[3] === 'lxlabs-updates') {
             $out['kloxo_status'] = 'on';
         }
         $out['repo'] = $v[3];
         $res[] = $out;
     }
     //dprintr($res);
     return $res;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:47,代码来源:package__up2datelib.php


示例4: parse_etc_mime

function parse_etc_mime()
{
    $list = lfile_trim("/etc/mime.types");
    foreach ($list as $s) {
        if (!$s) {
            continue;
        }
        if ($s[0] === '#') {
            continue;
        }
        $s = trimSpaces($s);
        $s = explode(" ", $s);
        $type = array_shift($s);
        foreach ($s as $ss) {
            $res[$ss] = $type;
        }
    }
    return $res;
}
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:19,代码来源:sitepreview.php


示例5: getAuthorizedKey

 static function getAuthorizedKey($username)
 {
     $v = self::readAuthorizedKey($username);
     $list = explode("\n", $v);
     foreach ($list as $l) {
         $l = trim($l);
         if (!$l) {
             continue;
         }
         $l = trimSpaces($l);
         $vv = explode(" ", $l);
         $r['nname'] = fix_nname_to_be_variable_without_lowercase($vv[1]);
         $r['full_key'] = $l;
         $r['key'] = substr($vv[1], 0, 50);
         $r['key'] .= " .....";
         $r['hostname'] = $vv[2];
         $r['username'] = $username;
         $r['type'] = $vv[0];
         $res[$r['nname']] = $r;
     }
     return $res;
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:22,代码来源:sshauthorizedkey__sync.php


示例6: updatepermalink

 function updatepermalink($param)
 {
     $name = $param['lighty_pretty_app_f'];
     $path = $param['lighty_pretty_path_f'];
     $list = lfile_trim("../file/prettyurl/{$name}");
     $list[0] = trimSpaces($list[0]);
     list($t, $type, $typen) = explode(" ", $list[0]);
     array_shift($list);
     if ($type === '404' || $typen === '404') {
         $this->customerror_b->url_404 = str_replace("<%lxpath%>", $path, $list[0]);
         array_shift($list);
     }
     if ($type === 'rewrite' || $typen === 'rewrite') {
         $string = implode("\n", $list);
         $this->text_lighty_rewrite = str_replace("<%lxpath%>", $path, $string);
     }
     return $param;
 }
开发者ID:zseand,项目名称:kloxo,代码行数:18,代码来源:weblib.php


示例7: get_vpsid_from_ipaddress

function get_vpsid_from_ipaddress($ip)
{
    static $res;
    if (!$res) {
        $res = lxshell_output('vzlist', '-H', '-o', 'vpsid,ip');
    }
    $list = explode("\n", $res);
    foreach ($list as $l) {
        $l = trimSpaces($l);
        if (csa($l, $ip)) {
            list($vpsid) = explode(" ", $l);
            return $vpsid;
        }
    }
    return 0;
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:16,代码来源:iptraffic.php


示例8: get_bytes_for_interface

 /**
  * Get the bytes for a given interface.
  *
  * Recollect the bytes column (incoming and outgoing) from
  * the file /proc/net/dev for a given interface on a machine.
  *
  * @author Anonymous <[email protected]>
  * @author Ángel Guzmán Maeso <[email protected]>
  * 
  * @param string $interface The interface name. NULL by default.
  * @return array[integer] total, incoming, outgoing
  */
 public static function get_bytes_for_interface($interface = NULL)
 {
     static $networks;
     // Make a cache with the networks available
     // Recollect the data for first time if not cached
     if (!isset($networks) || empty($networks)) {
         $networks = lfile_get_contents('/proc/net/dev');
         $networks = explode(PHP_EOL, $networks);
     }
     foreach ($networks as $network) {
         $vif_interface = 'vif' . $interface . ':';
         $network = trimSpaces($network);
         if (!char_search_beg($network, $vif_interface)) {
             continue;
         }
         // Parse the data for get total/incoming/outgoing
         $network = strfrom($network, $vif_interface);
         $network = trimSpaces($network);
         $network_bytes = explode(' ', $network);
         $total_incoming = $network_bytes[8];
         $total_outgoing = $network_bytes[0];
         $total = $total_outgoing + $total_incoming;
         // It seems for xen it is the reverse. The input for the vif is the output for the virtual machine.
         return array('total' => $total, 'incoming' => $total_incoming, 'outgoing' => $total_outgoing);
     }
     return 0;
     // Return 0 bytes
 }
开发者ID:digideskio,项目名称:hypervm,代码行数:40,代码来源:vps__xenlib.php


示例9: getBlockIP

 function getBlockIP()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $t = trimSpaces($this->main->text_blockip);
     $t = trim($t);
     if (!$t) {
         return;
     }
     $t = str_replace(".*", "", $t);
     $string = null;
     $string .= "\t<Location />\n";
     $string .= "\t\tOrder allow,deny\n";
     $string .= "\t\tdeny from {$t}\n";
     $string .= "\t\tallow from all\n";
     $string .= "\t</Location>\n\n";
     return $string;
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:17,代码来源:web__apachelib.php


示例10: find_hop

function find_hop($l)
{
    global $global_dontlogshell;
    $global_dontlogshell = true;
    $out = lxshell_output("ping -c 1 {$l}");
    $list = explode("\n", $out);
    foreach ($list as $l) {
        $l = trim($l);
        if (csb($l, "rtt")) {
            continue;
        }
        $l = trimSpaces($l);
        $ll = explode(" ", $l);
        $lll = explode("/", $ll[3]);
        return round($lll[1], 1);
    }
}
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:17,代码来源:lib.php


示例11: lxfile_get_uncompressed_size

function lxfile_get_uncompressed_size($file)
{
    global $global_dontlogshell;
    $tmp = $global_dontlogshell;
    $global_dontlogshell = true;
    $out = lxshell_output("gzip", "-l", $file);
    if (csa($out, "not in")) {
        return 0;
    }
    $out = trim($out);
    if (!$out) {
        return 0;
    }
    $out = explode("\n", $out);
    $out = trimSpaces($out[1]);
    $out = explode(" ", $out);
    $global_dontlogshell = $tmp;
    return $out[1];
}
开发者ID:zseand,项目名称:kloxo,代码行数:19,代码来源:linuxfslib.php


示例12: os_get_default_ethernet

function os_get_default_ethernet()
{
    $res = lxshell_output("route", "-n");
    $re = explode("\n", $res);
    foreach ($re as $r) {
        if (csb($r, "0.0.0.0")) {
            $r = trimSpaces($r);
            $o = explode(" ", $r);
            return trim($o[7]);
        }
    }
    return null;
}
开发者ID:zseand,项目名称:kloxo,代码行数:13,代码来源:linuxlib.php


示例13: getTimeFromSysLogString

function getTimeFromSysLogString($line)
{
    $line = trimSpaces($line);
    $year = @date('Y');
    list($month, $day, $time) = explode(" ", $line);
    $month = get_num_for_month($month);
    list($hour, $min, $sec) = explode(':', $time);
    //$s  =  mktime($hour , $min , $sec , monthToInt($month), str_pad($day , 2, 0, STR_PAD_LEFT) , $year);
    $s = @mktime($hour, $min, $sec, $month, $day, $year);
    //dprint(" $date $time $hour, $min $sec $month, $day , $year, Time: $s\n");
    // Return date and size. The size param is not important. Our aim is to find the right position.
    return $s;
}
开发者ID:digideskio,项目名称:hypervm,代码行数:13,代码来源:lxguardincludelib.php


示例14: parse_data

 static function parse_data($data)
 {
     foreach ($data as $d) {
         $d = trimSpaces($d);
         $d = str_replace(":", "", $d);
         $rval = explode(" ", $d);
         $res[strtolower($rval[0])] = $rval[1];
     }
     return $res;
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:10,代码来源:pserver__linuxlib.php


示例15: getBlockIP

 function getBlockIP()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $t = trimSpaces($this->main->text_blockip);
     $t = trim($t);
     if (!$t) {
         return;
     }
     $t = str_replace(".*", "", $t);
     $t = str_replace(" ", "|", $t);
     $string = "\$HTTP[\"remoteip\"] =~ \"{$t}\" {\n";
     $string .= "url.access-deny = ( \"\" )\n";
     $string .= "}\n";
     return $string;
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:15,代码来源:web__lighttpdlib.php


示例16: exit

<?php

include_once "htmllib/lib/include.php";
if ($sgbl->isHyperVm()) {
    exit(10);
}
if (lxfile_exists("/proc/user_beancounters")) {
    $list = lfile("/proc/user_beancounters");
    foreach ($list as $l) {
        $l = trimSpaces($l);
        if (!csb($l, "privvmpages")) {
            continue;
        }
        $d = explode(" ", $l);
        $mem = $d[3] / 256;
    }
    exit(11);
} else {
    if (lxfile_exists("/proc/xen")) {
        exit(11);
    } else {
        $mem = pserver__linux::getTotalMemory();
        $mem += 200;
    }
}
if ($mem < 180) {
    exit(15);
}
exit(11);
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:29,代码来源:checktotalmemory.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP trim_array函数代码示例发布时间:2022-05-23
下一篇:
PHP trimAll函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap