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

PHP lfile_put_contents函数代码示例

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

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



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

示例1: os_fix_fstab

function os_fix_fstab()
{
    $list = lfile_trim("/etc/fstab");
    foreach ($list as $l) {
        $nl = trimSpaces($l);
        $n = explode(" ", $nl);
        if ($n[1] !== "/home" && $n[1] !== '/') {
            $out[] = $l;
            continue;
        }
        if (!csa($n[3], "usrquota")) {
            $mount[] = $n[1];
            $n[3] = "{$n['3']},usrquota,grpquota";
        }
        $o = implode("\t", $n);
        $out[] = $o;
    }
    $out = implode("\n", $out);
    $out .= "\n";
    dprint($out);
    lfile_put_contents("/etc/fstab", $out);
    dprintr($mount);
    foreach ($mount as $m) {
        system("mount {$m} -o remount");
    }
}
开发者ID:zseand,项目名称:kloxo,代码行数:26,代码来源:linuxlib.php


示例2: convertfile

 static function convertfile($oldtime, $newtime)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $file = '/var/log/kloxo/maillog';
     if (!lxfile_real($file)) {
         return null;
     }
     $fp = fopen($file, "r");
     $fsize = filesize($file);
     $ret = FindRightPosition($fp, $fsize, $oldtime, $newtime, array("mailtraffic", "getTimeFromOriginalQmailString"));
     if ($ret < 0) {
         dprint("Could not find position\n");
         return;
     }
     $totstring = null;
     $count = 0;
     while (!feof($fp)) {
         $count++;
         if ($count > 1000000) {
             break;
         }
         $string = fgets($fp);
         $totstring .= $string;
         if (self::getTimeFromOriginalQmailString($string) > $newtime) {
             break;
         }
     }
     fclose($fp);
     $convertfile = tempnam("/tmp/", "mail_log");
     $convertfile_source = tempnam("/tmp/", "mail_log_source");
     lfile_put_contents($convertfile_source, $totstring);
     system("perl {$sgbl->__path_kloxo_httpd_root}/awstats/tools/maillogconvert.pl standard < {$convertfile_source} > {$convertfile}");
     lunlink($convertfile_source);
     return $convertfile;
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:35,代码来源:mailtrafficlib.php


示例3: createDnsData

 function createDnsData()
 {
     dprint("DbActionAdd\n");
     $fdata = "";
     $tmp = "";
     $this->createPrimaryZone($this->main->nname);
     lfile_put_contents("c:/Windows/System32/drivers/etc/hosts", "127.0.0.1 {$this->main->nname}", FILE_APPEND);
     return null;
 }
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:9,代码来源:dns__msdnslib.php


示例4: createMimeType

 function createMimeType()
 {
     $result = $this->main->__var_mime_list;
     $result = merge_array_object_not_deleted($result, $this->main);
     $string = null;
     foreach ($result as $r) {
         $string .= "Addtype {$r['type']} {$r['extension']}\n";
     }
     lfile_put_contents("/etc/httpd/conf/kloxo/mimetype.conf", $string);
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:10,代码来源:mimetype__apachelib.php


示例5: moveToTrash

 static function moveToTrash($user, $root, $name)
 {
     $trashcont = "{$root}/.trash/.__trash_" . basename($name);
     $fullpath = "{$root}/{$name}";
     lxfile_rm_rec("{$root}/.trash/" . basename($name));
     lxfile_rm_rec($trashcont);
     $res = lxuser_mkdir($user, "{$root}/.trash/");
     lfile_put_contents($trashcont, $name . "\n");
     $res = new_process_mv_rec($user, $fullpath, "{$root}/.trash");
     //unlink($f);
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:11,代码来源:ffile__commonlib.php


示例6: lxshell_expect

function lxshell_expect($strtype, $cmd)
{
    global $gbl, $sgbl, $login, $ghtml;
    $a = array("ntfsresize" => "expect \"Are you sure you want to proceed (y/[n])? \"\nsend \"y\\r\"\n\n");
    $t = lx_tmp_file("expect");
    $string = $a['ntfsresize'];
    lfile_put_contents($t, "spawn {$cmd}\n{$string}");
    log_shell("expect {$t} {$cmd}");
    system("expect {$t}");
    //lunlink($t);
}
开发者ID:zseand,项目名称:kloxo,代码行数:11,代码来源:linuxfslib.php


示例7: createUser

 function createUser()
 {
     $domname = $this->main->getParentName();
     $dir = "__path_httpd_root/{$domname}/dirprotect/";
     $authuserfile = "{$dir}/{$this->main->getFileName()}";
     $fstr = null;
     foreach ($this->main->diruser_a as $v) {
         $crypt = crypt($v->param, $this->genSalt());
         $fstr .= "{$v->nname}:{$crypt}";
         //$fstr .= $v->nname . ':' . $v->param . "\n";
     }
     lfile_put_contents($authuserfile, $fstr);
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:13,代码来源:dirprotect__iislib.php


示例8: dosyncToSystem

 function dosyncToSystem()
 {
     global $gbl, $sgbl, $login;
     if (if_demo()) {
         return;
     }
     $_filepath = "__path_real_etc_root/hosts.deny";
     $string = null;
     foreach ((array) $this->main->__var_hostlist as $v) {
         $string .= "ALL: {$v['hostname']}\n";
     }
     if ($this->isDeleted() != "delete") {
         $string .= "ALL: {$this->main->hostname}\n";
     }
     lfile_put_contents($_filepath, $string);
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:16,代码来源:hostdeny__windowslib.php


示例9: createDavSuexec

 function createDavSuexec()
 {
     $string = null;
     $uid = os_get_uid_from_user($this->main->__var_system_username);
     $gid = os_get_gid_from_user($this->main->__var_system_username);
     $string .= "#!/bin/sh\n";
     $string .= "export MUID={$uid}\n";
     $string .= "export GID={$gid}\n";
     $string .= " export PHPRC=/usr/local/lxlabs/ext/php/etc/php.ini\n";
     $string .= "export TARGET=<%program%>\n";
     $string .= "export NON_RESIDENT=1\n";
     $string .= "exec lxsuexec \$*\n";
     $st = str_replace("<%program%>", "/usr/local/lxlabs/ext/php/bin/php_cgi", $string);
     lfile_put_contents("__path_httpd_root/{$this->main->getParentName()}/davsuexec.sh", $st);
     lxfile_unix_chmod("__path_httpd_root/{$this->main->getParentName()}/davsuexec.sh", "0755");
 }
开发者ID:soar-team,项目名称:kloxo,代码行数:16,代码来源:davuser__lighttpdlib.php


示例10: createDnsData

 function createDnsData()
 {
     dprint("DbActionAdd\n");
     $fdata = "";
     $tmp = "";
     $this->createPrimaryZone($this->main->nname);
     lfile_put_contents("c:/Windows/System32/drivers/etc/hosts", "127.0.0.1 {$this->main->nname}", FILE_APPEND);
     return;
     if ($this->main->ns_rec_a != '') {
         foreach ($this->main->ns_rec_a as $value) {
             $this->createNSRecord($this->main->nname, $value->nname);
         }
     }
     if ($this->main->mx_rec_a != '') {
         foreach ($this->main->mx_rec_a as $o) {
             $this->createMxRecord($this->main->nname, 'something', $o->param, $o->nname);
         }
     }
     if ($this->main->a_rec_a) {
         foreach ($this->main->a_rec_a as $o) {
             $key = $o->nname;
             $value = $o->param;
             if ($o->param === null) {
                 continue;
             }
             $this->createARecord($this->main->nname, $key, $value);
         }
     }
     if ($this->main->cn_rec_a != '') {
         foreach ($this->main->cn_rec_a as $o) {
             $key = $o->nname;
             $value = $o->param;
             if ($o->param === null) {
                 continue;
             }
             $key .= ".{$this->main->nname}.";
             if ($value !== "__base__") {
                 $value = "{$value}.{$this->main->nname}.";
             } else {
                 $value = "{$this->main->nname}.";
             }
             $fdata .= $tmp;
         }
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:45,代码来源:dns__msdnslib.php


示例11: createMainFile

 function createMainFile()
 {
     global $gbl, $sgbl, $login, $ghtml;
     list($base, $end) = reversedns::getBaseEnd($this->main->nname, $this->main->__var_rdnsrange);
     $string = null;
     $transferstring = null;
     if ($this->main->__var_transferip) {
         $transferstring = "allow-transfer { {$this->main->__var_transferip}; };";
     }
     foreach ($this->main->__var_reverse_list as $k => $v) {
         if ($k === $base) {
             continue;
         }
         $string .= "zone \"{$k}.in-addr.arpa\" {type master; file \"{$sgbl->__path_named_path}/{$k}.in-addr.arpa\"; {$transferstring}};\n\n";
     }
     $string .= "zone \"{$base}.in-addr.arpa\" {type master; file \"{$sgbl->__path_named_path}/{$base}.in-addr.arpa\"; {$transferstring}};\n\n";
     lfile_put_contents("__path_named_chroot/etc/lxreverse.conf", $string);
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:18,代码来源:reversedns__bindlib.php


示例12: changeSuperAdminPass

 function changeSuperAdminPass()
 {
     if ($this->nname === 'superadmin') {
         $oldpass = getAdminDbPass();
         $newp = client::createDbPass($this->realpass);
         $return = lfile_put_contents("__path_super_pass", $newp);
         if (!$return) {
             log_log("admin_error", "Admin pass change failed  {$last_error}");
             throw new lxException("could_not_change_superadmin_pass", '');
         }
         $return = $sql->setPassword($newp);
         if ($return) {
             $return = lfile_put_contents("__path_super_pass", $oldpass);
             log_log("admin_error", "mysqladmin Failed . {$out}");
             throw new lxException("could_not_change_superadmin_pass", '');
         }
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:18,代码来源:superclientlib.php


示例13: create_mysql_db

function create_mysql_db($type, $opt, $admin_pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    $db = $sgbl->__var_dbf;
    if (!isset($opt['db-rootuser']) || !isset($opt['db-rootpassword'])) {
        print "Need db Root User and password --db-rootuser, --db-rootpassword \n";
        exit;
    }
    if ($sgbl->__var_database_type === 'mysql') {
        // TODO: REPLACE MYSQL_CONNECT
        // TUT TUT naughty programmer... We are creating the db now XD
        $req = mysqli_connect('localhost', $opt['db-rootuser'], $opt['db-rootpassword']);
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            $req = mssql_connect("localhost,{$sgbl->__var_mssqlport}");
        } else {
            $req = new PDO("sqlite:{$db}");
        }
    }
    if (!$req) {
        print "Could not Connect to Database on localhost using root user: " . mysqli_connect_error() . "\n";
    }
    //$sqlcm = lfile_get_contents("__path_program_root/httpdocs/sql/init/$type.sql");
    $dp = randomString(9);
    $dbadminpass = client::createDbPass($dp);
    $dbname = $sgbl->__var_dbf;
    $pguser = $sgbl->__var_admin_user;
    if ($sgbl->__var_database_type === 'mysql') {
        @mysqli_query($req, "CREATE DATABASE {$dbname}");
        mysqli_query($req, "GRANT ALL ON {$dbname}.* TO '{$pguser}'@'localhost' IDENTIFIED BY '{$dbadminpass}';");
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            mssql_query("create database {$dbname};");
            mssql_query("use master ");
            mssql_query("sp_addlogin '{$pguser}', '{$dbadminpass}', '{$dbname}';");
            mssql_query("use {$dbname} ");
            mssql_query("grant all to {$pguser}");
        } else {
        }
    }
    lfile_put_contents("__path_admin_pass", $dbadminpass);
    lxfile_generic_chown("__path_admin_pass", "lxlabs");
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:44,代码来源:initlib.php


示例14: create_mysql_db

function create_mysql_db($type, $opt, $admin_pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    if (!isset($opt['db-rootuser']) || !isset($opt['db-rootpassword'])) {
        print "Need db Root User and password --db-rootuser, --db-rootpassword \n";
        exit;
    }
    if ($sgbl->__var_database_type === 'mysql') {
        $req = mysql_connect('localhost', $opt['db-rootuser'], $opt['db-rootpassword']);
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            $req = mssql_connect("localhost,{$sgbl->__var_mssqlport}");
        } else {
            $req = new PDO("sqlite:{$sgbl->__var_dbf}");
        }
    }
    if (!$req) {
        print "Could not Connect to Database on localhost using root user\n";
    }
    //$sqlcm = lfile_get_contents("__path_program_root/httpdocs/sql/init/$type.sql");
    $dp = randomString(9);
    $dbadminpass = client::createDbPass($dp);
    $dbname = $sgbl->__var_dbf;
    $pguser = $sgbl->__var_admin_user;
    if ($sgbl->__var_database_type === 'mysql') {
        @mysql_query("create database {$dbname}");
        mysql_query("grant all on {$dbname}.* to '{$pguser}'@'localhost' identified by '{$dbadminpass}';");
    } else {
        if ($sgbl->__var_database_type === 'mssql') {
            mssql_query("create database {$dbname};");
            mssql_query("use master ");
            mssql_query("sp_addlogin '{$pguser}', '{$dbadminpass}', '{$dbname}';");
            mssql_query("use {$dbname} ");
            mssql_query("grant all to {$pguser}");
        } else {
        }
    }
    lfile_put_contents("__path_admin_pass", $dbadminpass);
    lxfile_generic_chown("__path_admin_pass", "lxlabs");
}
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:41,代码来源:initlib.php


示例15: readAuthorizedKey

 static function readAuthorizedKey($username)
 {
     $p = os_get_home_dir($username);
     if ($p === '/tmp' && $username) {
         lxfile_mkdir("/home/{$username}");
         lxshell_return("usermod", "-d", "/home/{$username}", $username);
         lxfile_unix_chown_rec("/home/{$username}", "{$username}:{$username}");
         $p = "/home/{$username}";
     }
     if (!$p) {
         return;
     }
     $f = "{$p}/.ssh/authorized_keys";
     if (lxfile_exists("{$f}2")) {
         $s = lfile_get_contents("{$f}2");
         $s = "\n{$s}\n";
         lfile_put_contents($f, $s, FILE_APPEND);
         lunlink("{$f}2");
     }
     return lfile_get_contents($f);
 }
开发者ID:digideskio,项目名称:hypervm,代码行数:21,代码来源:sshauthorizedkey__sync.php


示例16: createDhcpConfFile

 static function createDhcpConfFile($slist)
 {
     $list = os_get_allips();
     foreach ($list as $l) {
         $base = strtil($l, ".");
         $subnet[$base] = null;
     }
     $string = null;
     $string .= "ddns-update-style interim;\n";
     $string .= "ignore client-updates;\n\n\n";
     $string .= self::getSubnetString($k, $slist);
     /*
     	foreach($subnet as $k => $v) {
     		$string .= self::getSubnetString($k, $slist);
     	}
     */
     foreach ($slist as $s) {
         $string .= self::getHostString($s);
     }
     lfile_put_contents("/etc/dhcpd.conf", $string);
     createRestartFile("dhcpd");
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:22,代码来源:dhcp__dhcpdlib.php


示例17: dbactionUpdate

 function dbactionUpdate($subaction)
 {
     $name = sslcert::getSslCertnameFromIP($this->main->nname);
     $path = "__path_ssl_root";
     $contentscer = $this->main->text_crt_content;
     $contentskey = $this->main->text_key_content;
     $contentsca = trim($this->main->text_ca_content);
     if (!$contentscer || !$contentskey) {
         throw new lxException("certificate_key_file_empty", '');
     }
     sslcert::checkAndThrow($contentscer, $contentskey, $name);
     lfile_put_contents("{$path}/{$name}.crt", $contentscer);
     lfile_put_contents("{$path}/{$name}.key", $contentskey);
     $contentpem = "{$contentscer}\n{$contentskey}";
     lfile_put_contents("{$path}/{$name}.pem", $contentpem);
     if ($contentsca) {
         lfile_put_contents("{$path}/{$name}.ca", $contentsca);
     } else {
         lxfile_cp("htmllib/filecore/program.ca", "{$path}/{$name}.ca");
     }
     createRestartFile($this->main->__var_webdriver);
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:22,代码来源:sslipaddress__synclib.php


示例18: add_line_to_secondary_mycnf

function add_line_to_secondary_mycnf($master, $slavepass)
{
    global $gbl, $sgbl, $login, $ghtml;
    if (!lxfile_exists("/etc/secondary_master.copy.my.cnf")) {
        lxfile_cp("/etc/my.cnf", "/etc/secondary_master.copy.my.cnf");
    }
    $list = lfile_trim("/etc/my.cnf");
    foreach ($list as $k => $l) {
        if (check_if_skip($l)) {
            continue;
        }
        $ll[] = $l;
        if ($l == '[mysqld]') {
            $ll[] = "server-id=2";
            $ll[] = "master-host={$master}";
            $ll[] = "master-user=lxlabsslave";
            $ll[] = "master-password={$slavepass}";
        }
    }
    lfile_put_contents("/etc/my.cnf", implode("\n", $ll));
    system("service mysqld restart");
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:22,代码来源:setupsecondary.php


示例19: dbactionUpdate

 function dbactionUpdate($subaction)
 {
     if (if_demo()) {
         throw new lxException("demo", $v);
     }
     if ($this->main->ssh_port && !($this->main->ssh_port > 0)) {
         throw new lxException('invalid_ssh_port', 'ssh_port', '');
     }
     dprint($this->main->ssh_port);
     $this->main->ssh_port = trim($this->main->ssh_port);
     if (!$this->main->ssh_port) {
         $port = "22";
     } else {
         $port = $this->main->ssh_port;
     }
     if (lxfile_exists("/etc/fedora-release")) {
         $str = lfile_get_contents("../file/template/sshd_config-fedora-2");
     } else {
         $str = lfile_get_contents("../file/template/sshd_config");
     }
     $str = str_replace("%ssh_port%", $port, $str);
     if ($this->main->isOn('without_password_flag')) {
         $wt = 'without-password';
     } else {
         $wt = 'yes';
     }
     if ($this->main->isOn('disable_password_flag')) {
         $pwa = 'no';
     } else {
         $pwa = 'yes';
     }
     $str = str_replace("%permit_root_login%", $wt, $str);
     $str = str_replace("%permit_password%", $pwa, $str);
     $ret = lfile_put_contents("/etc/ssh/sshd_config", $str);
     if (!$ret) {
         throw new lxException('could_not_write_config_file', '', '');
     }
     exec_with_all_closed("/etc/init.d/sshd restart");
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:39,代码来源:sshconfig__linuxlib.php


示例20: add_line_to_master_mycnf

function add_line_to_master_mycnf()
{
    global $gbl, $sgbl, $login, $ghtml;
    $dbf = $sgbl->__var_dbf;
    if (!lxfile_exists("/etc/primary_master.copy.my.cnf")) {
        lxfile_cp("/etc/my.cnf", "/etc/primary_master.copy.my.cnf");
    }
    $v = lfile_get_contents("/etc/my.cnf");
    if (csa($v, "binlog-do-db")) {
        print "Line already exists in /etc/my.cnf\n";
        return;
    }
    $list = lfile_trim("/etc/my.cnf");
    foreach ($list as $k => $l) {
        $ll[] = $l;
        if ($l == '[mysqld]') {
            $ll[] = "log-bin=mysql-bin";
            $ll[] = "binlog-do-db={$dbf}";
            $ll[] = "server-id=1";
        }
    }
    lfile_put_contents("/etc/my.cnf", implode("\n", $ll));
    system("service mysqld restart");
}
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:24,代码来源:setupprimarymaster.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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