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

PHP fClose函数代码示例

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

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



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

示例1: siemens_push_str

function siemens_push_str($phone_ip, $postdata)
{
    $prov_host = gs_get_conf('GS_PROV_HOST');
    $data = "POST /server_push.html/ServerPush HTTP/1.1\r\n";
    $data .= "User-Agent: Gemeinschaft\r\n";
    $data .= "Host: {$phone_ip}:8085\r\n";
    $data .= "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n";
    $data .= "Connection: keep-alive\r\n";
    $data .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $data .= "Content-Length: " . strLen($postdata) . "\r\n\r\n";
    $data .= $postdata;
    $socket = @fSockOpen($phone_ip, 8085, $error_no, $error_str, 4);
    if (!$socket) {
        gs_log(GS_LOG_NOTICE, "Siemens: Failed to open socket - IP: {$phone_ip}");
        return 0;
    }
    stream_set_timeout($socket, 4);
    $bytes_written = (int) @fWrite($socket, $data, strLen($data));
    @fFlush($socket);
    $response = @fGetS($socket);
    @fClose($socket);
    if (strPos($response, '200') === false) {
        gs_log(GS_LOG_WARNING, "Siemens: Failed to push to phone {$phone_ip}");
        return 0;
    }
    gs_log(GS_LOG_DEBUG, "Siemens: Pushed {$bytes_written} bytes to phone {$phone_ip}");
    return $bytes_written;
}
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:28,代码来源:siemens-fns.php


示例2: send_sip_packet

function send_sip_packet($ip, $port, $packet, $source_ip = false)
{
    $spoof = $source_ip ? '-s \'' . $source_ip . '\'' : '';
    $p = pOpen('netcat -u -n -p 5060 -w 1 -q 0 ' . $spoof . ' ' . $ip . ' ' . $port . ' >>/dev/null', 'wb');
    fWrite($p, $packet, strLen($packet));
    fClose($p);
}
开发者ID:rkania,项目名称:GS3,代码行数:7,代码来源:sip-desktop-message.php


示例3: InitRecordCall

function InitRecordCall($filename, $index, $comment)
{
    //FIXME
    $user = gs_user_get($_SESSION['sudo_user']['name']);
    $call = "Channel: SIP/" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: vm-rec-multiple\n" . "Extension: webdialrecord\n" . "Callerid: {$comment} <Aufnahme>\n" . "Setvar: __user_id=" . $_SESSION['sudo_user']['info']['id'] . "\n" . "Setvar: __user_name=" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __callfile_from_user=" . $_SESSION['sudo_user']['info']['ext'] . "\n" . "Setvar: __record_file=" . $filename . "\n";
    $filename = '/tmp/gs-' . $_SESSION['sudo_user']['info']['id'] . '-' . _pack_int(time()) . rand(100, 999) . '.call';
    $cf = @fOpen($filename, 'wb');
    if (!$cf) {
        gs_log(GS_LOG_WARNING, 'Failed to write call file "' . $filename . '"');
        echo 'Failed to write call file.';
        die;
    }
    @fWrite($cf, $call, strLen($call));
    @fClose($cf);
    @chmod($filename, 0666);
    $spoolfile = '/var/spool/asterisk/outgoing/' . baseName($filename);
    if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
        $our_host_ids = @gs_get_listen_to_ids();
        if (!is_array($our_host_ids)) {
            $our_host_ids = array();
        }
        $user_is_on_this_host = in_array($_SESSION['sudo_user']['info']['host_id'], $our_host_ids);
    } else {
        $user_is_on_this_host = true;
    }
    if ($user_is_on_this_host) {
        # the Asterisk of this user and the web server both run on this host
        $err = 0;
        $out = array();
        @exec('sudo mv ' . qsa($filename) . ' ' . qsa($spoolfile) . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            @unlink($filename);
            gs_log(GS_LOG_WARNING, 'Failed to move call file "' . $filename . '" to "' . '/var/spool/asterisk/outgoing/' . baseName($filename) . '"');
            echo 'Failed to move call file.';
            die;
        }
    } else {
        $cmd = 'sudo scp -o StrictHostKeyChecking=no -o BatchMode=yes ' . qsa($filename) . ' ' . qsa('root@' . $user['host'] . ':' . $filename);
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        @unlink($filename);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to scp call file "' . $filename . '" to ' . $user['host']);
            echo 'Failed to scp call file.';
            die;
        }
        //remote_exec( $user['host'], $cmd, 10, $out, $err ); // <-- does not use sudo!
        $cmd = 'sudo ssh -o StrictHostKeyChecking=no -o BatchMode=yes -l root ' . qsa($user['host']) . ' ' . qsa('mv ' . qsa($filename) . ' ' . qsa($spoolfile));
        //echo $cmd, "\n";
        @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err);
        if ($err != 0) {
            gs_log(GS_LOG_WARNING, 'Failed to mv call file "' . $filename . '" on ' . $user['host'] . ' to "' . $spoolfile . '"');
            echo 'Failed to mv call file on remote host.';
            die;
        }
    }
}
开发者ID:rkania,项目名称:GS3,代码行数:57,代码来源:forwards_queues.php


示例4: _shReadSecStatsFromFile

 private static function _shReadSecStatsFromFile($shFileName)
 {
     $logFile = fopen($shFileName, 'r');
     if ($logFile) {
         while (!feof($logFile)) {
             $line = fgets($logFile, 4096);
             self::_shDecodeSecLogLine($line);
         }
         fClose($logFile);
     }
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:11,代码来源:security.php


示例5: _shReadSecStatsFromFile

 private function _shReadSecStatsFromFile($shFileName)
 {
     $logFile = fopen($shFileName, 'r');
     if ($logFile) {
         while (!feof($logFile)) {
             $line = fgets($logFile, 4096);
             Sh404sefHelperSecurity::_shDecodeSecLogLine($line);
         }
         fClose($logFile);
     }
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:11,代码来源:security.php


示例6: set

 /**
  * @see	\dns\system\cache\source\ICacheSource::set()
  */
 public function set($cacheName, $value, $maxLifetime)
 {
     $filename = $this->getFilename($cacheName);
     $content = "<?php exit; /* cache: " . $cacheName . " (generated at " . gmdate('r') . ") DO NOT EDIT THIS FILE */ ?>\n";
     $content .= serialize($value);
     if (!file_exists($filename)) {
         @touch($filename);
     }
     $handler = fOpen($filename, "a+");
     fWrite($handler, $content);
     fClose($handler);
 }
开发者ID:cengjing,项目名称:Domain-Control-Panel,代码行数:15,代码来源:DiskCacheSource.class.php


示例7: parse

 function parse($quizFileName)
 {
     $quizFile = fOpen($quizFileName, 'r');
     if ($quizFile) {
         $this->parseStart();
         while (($quizLine = fGets($quizFile, 4096)) !== false) {
             $this->parseLine($quizLine);
         }
         $this->parseEnd();
         fClose($quizFile);
     }
 }
开发者ID:RichardMartin,项目名称:uQuiz,代码行数:12,代码来源:QuizParser.php


示例8: gs_send_phone_desktop_msg

function gs_send_phone_desktop_msg($ip, $port, $ext, $registrar, $text, $extra = array())
{
    static $sock = null;
    static $lAddr = '0.0.0.0';
    static $lPort = 0;
    static $have_sockets = null;
    if ($have_sockets === null) {
        $have_sockets = function_exists('socket_create');
        // about 15 to 45 % faster
    }
    if (is_array($extra) && array_key_exists('fake_callid', $extra)) {
        $fake_callid = $extra['fake_callid'];
    } else {
        $fake_callid = rand(1000000000, 2000000000);
    }
    if ($have_sockets) {
        if (!$sock) {
            $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
            if (!$sock) {
                return false;
            }
            //socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1);
            //socket_bind($sock, '0.0.0.0', 12345);
            @socket_getSockName($sock, $lAddr, $lPort);
            //echo "Local socket is at $lAddr:$lPort\n";
            @socket_set_nonblock($sock);
        }
    } else {
        $sock = @fSockOpen('udp://' . $ip, $port, $err, $errmsg, 1);
        if (!$sock) {
            return false;
        }
        @stream_set_blocking($sock, 0);
        @stream_set_timeout($sock, 1);
    }
    $sipmsg = 'MESSAGE sip:' . $ext . '@' . $ip . ' SIP/2.0' . "\r\n" . 'Via: SIP/2.0/UDP ' . $registrar . ':' . $lPort . "\r\n" . 'To: sip:' . $ext . '@' . $ip . '' . "\r\n" . 'Call-ID: ' . $fake_callid . '@' . $registrar . "\r\n" . 'CSeq: 1 MESSAGE' . "\r\n" . 'Content-Type: text/plain; charset=utf-8' . "\r\n" . 'Max-Forwards: 9' . "\r\n" . 'From: sip:fake@' . $registrar . ':' . $lPort . ';tag=fake' . "\r\n" . 'Content-Length: ' . strLen($text) . "\r\n" . 'Content-Disposition: desktop' . "\r\n" . "\r\n" . $text;
    if ($have_sockets) {
        return @socket_sendto($sock, $sipmsg, strLen($sipmsg), 0, $ip, $port);
    } else {
        $written = @fWrite($sock, $sipmsg, strlen($sipmsg));
        @fClose($sock);
        return $written;
    }
}
开发者ID:rkania,项目名称:GS3,代码行数:44,代码来源:send-phone-msg.php


示例9: send

 function send($data = '')
 {
     if ($this->sock) {
         fwrite($this->sock, trim(strToUpper($this->method)) . " " . (array_key_exists('path', $this->url) ? $this->url['path'] : "") . (array_key_exists('query', $this->url) ? "?{$this->url['query']}" : "") . " HTTP/1.1\r\n" . "Host: {$this->url['host']}\r\n" . $this->requestHeaders . (preg_match("/(^|\r\n)Connection: /", $this->requestHeaders) ? "" : "Connection: Close\r\n") . "\r\n" . $data);
         $this->responseText = '';
         $this->status = null;
         $this->statusText = null;
         $isBody = false;
         while (!feof($this->sock)) {
             $line = fgets($this->sock, 1024);
             if ($this->status === null) {
                 if (!preg_match("/^HTTP\\/[\\d.]+\\s+(\\d+)(\\s+([^\r\n]+))?/i", $line, $matches)) {
                     throw new Exception('Invalid response');
                 }
                 $this->status = intval($matches[1]);
                 if (isset($matches[3])) {
                     $this->statusText = $matches[3];
                 }
             } else {
                 if ($isBody) {
                     $this->responseText .= $line;
                 } else {
                     if (preg_match("/^[\r\n]+\$/", $line)) {
                         $isBody = true;
                     } else {
                         if (!preg_match("/^([^:]+):\\s*([^\r\n]+)/", $line, $matches)) {
                             throw new Exception('Invalid header');
                         }
                         $this->responseHeaders[$this->capitalize($matches[1])] = $matches[2];
                     }
                 }
             }
         }
         fClose($this->sock);
         if (array_key_exists('Transfer-Encoding', $this->responseHeaders) && preg_match('/(^|[,\\s])chunked([,\\s]|$)/i', $this->responseHeaders['Transfer-Encoding'])) {
             $this->responseText = preg_replace("/^[a-f0-9]+[^\r\n]*\r?\n|\r?\n0+[^\r\n]*[\r\n]+\$/i", '', $this->responseText);
         }
     }
 }
开发者ID:Rotmistrz,项目名称:forumweb,代码行数:39,代码来源:HttpRequest.class.php


示例10: aastra_push_str

function aastra_push_str($phone_ip, $xml)
{
    $prov_host = gs_get_conf('GS_PROV_HOST');
    //FIXME - call wget or something. this function should not block
    // for so long!
    // see _gs_prov_phone_checkcfg_by_ip_do_aastra() in
    // opt/gemeinschaft/inc/gs-fns/gs_prov_phone_checkcfg.php
    //$xml = utf8_decode($xml);
    if (subStr($xml, 0, 5) !== '<' . '?xml') {
        $xmlpi = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
    } else {
        $xmlpi = '';
    }
    $data = "POST / HTTP/1.1\r\n";
    $data .= "Host: {$phone_ip}\r\n";
    $data .= "Referer: {$prov_host}\r\n";
    $data .= "Connection: Close\r\n";
    $data .= "Content-Type: text/xml; charset=utf-8\r\n";
    $data .= "Content-Length: " . (strLen('xml=') + strLen($xmlpi) + strLen($xml)) . "\r\n";
    $data .= "\r\n";
    $data .= 'xml=' . $xmlpi . $xml;
    $socket = @fSockOpen($phone_ip, 80, $error_no, $error_str, 4);
    if (!$socket) {
        gs_log(GS_LOG_NOTICE, "Aastra: Failed to open socket - IP: {$phone_ip}");
        return 0;
    }
    stream_set_timeout($socket, 4);
    $bytes_written = (int) @fWrite($socket, $data, strLen($data));
    @fFlush($socket);
    $response = @fGetS($socket);
    @fClose($socket);
    if (strPos($response, '200') === false) {
        gs_log(GS_LOG_WARNING, "Aastra: Failed to push XML to phone {$phone_ip}");
        return 0;
    }
    gs_log(GS_LOG_DEBUG, "Aastra: Pushed {$bytes_written} bytes to phone {$phone_ip}");
    return $bytes_written;
}
开发者ID:rkania,项目名称:GS3,代码行数:38,代码来源:aastra-fns.php


示例11: parseIt

 protected function parseIt($filename = '')
 {
     if (!file_exists($filename) || !is_readable($filename)) {
         echo "file name error!";
         return FALSE;
     }
     $header = NULL;
     $data = array();
     if (($handle = fopen($filename, 'r')) !== FALSE) {
         while (($row = fgetcsv($handle, 0, ',')) !== FALSE) {
             if (!$header) {
                 $header = $row;
             } else {
                 $data[] = array_combine($header, $row);
             }
         }
         fClose($handle);
     }
     return $data;
 }
开发者ID:ravi2jdesign,项目名称:magentoOLD,代码行数:20,代码来源:ProdUp1Controller.php


示例12: shCloseLogFile

function shCloseLogFile()
{
    global $shLogger;
    if (!empty($shLogger)) {
        $shLogger->log('Closing log file at shutdown' . "\n\n");
        if (!empty($shLogger->logFile)) {
            fClose($shLogger->logFile);
        }
    }
}
开发者ID:sangkasi,项目名称:joomla,代码行数:10,代码来源:sh404sef.class.php


示例13: finish

 public function finish()
 {
     fClose($this->DumpFile);
 }
开发者ID:ljarray,项目名称:dbpedia,代码行数:4,代码来源:NTripleDumpDestination.php


示例14: buildlanguage

 /**
  * build language files from database
  *
  * @param	boolean	$force
  */
 public static function buildlanguage($force = false)
 {
     $availableLanguages = array("de", "en");
     foreach ($availableLanguages as $languageID => $languageCode) {
         $file = DNS_DIR . "/lang/" . $languageCode . ".lang.php";
         if (!file_exists($file) || filemtime($file) + 86400 < time() || $force === true) {
             if (file_exists($file)) {
                 @unlink($file);
             }
             @touch($file);
             $items = self::getDB()->query("select * from dns_language where languageID = ?", array($languageID));
             $content = "<?php\n/**\n* language: " . $languageCode . "\n* encoding: UTF-8\n* generated at " . gmdate("r") . "\n* \n* DO NOT EDIT THIS FILE\n*/\n";
             $content .= "\$lang = array();\n";
             while ($row = self::getDB()->fetch_array($items)) {
                 print_r($row);
                 $content .= "\$lang['" . $row['languageItem'] . "'] = '" . str_replace("\$", '$', $row['languageValue']) . "';\n";
             }
             $handler = fOpen($file, "a+");
             fWrite($handler, $content);
             fClose($handler);
         }
     }
 }
开发者ID:cengjing,项目名称:Domain-Control-Panel,代码行数:28,代码来源:DNS.class.php


示例15: gs_callforward_activate

function gs_callforward_activate($user, $source, $case, $active)
{
    if (!preg_match('/^[a-z0-9\\-_.]+$/', $user)) {
        return new GsError('User must be alphanumeric.');
    }
    if (!in_array($source, array('internal', 'external'), true)) {
        return new GsError('Source must be internal|external.');
    }
    if (!in_array($case, array('always', 'busy', 'unavail', 'offline'), true)) {
        return new GsError('Case must be always|busy|unavail|offline.');
    }
    if (!in_array($active, array('no', 'std', 'var', 'vml', 'ano', 'trl', 'par'), true)) {
        return new GsError('Active must be no|std|var|vml|ano|trl|par.');
    }
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get user_id
    #
    $user_id = $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($user) . '\'');
    if (!$user_id) {
        return new GsError('Unknown user.');
    }
    # get user_ext
    #
    $user_ext = $db->executeGetOne('SELECT `name` FROM `ast_sipfriends` WHERE `_user_id`=\'' . $db->escape($user_id) . '\'');
    if (!$user_ext) {
        return new GsError('Unknown user extension.');
    }
    # check if user has an entry
    #
    $num = $db->executeGetOne('SELECT COUNT(*) FROM `callforwards` WHERE `user_id`=' . $user_id . ' AND `source`=\'' . $db->escape($source) . '\' AND `case`=\'' . $db->escape($case) . '\'');
    if ($num < 1) {
        $ok = $db->execute('INSERT INTO `callforwards` (`user_id`, `source`, `case`, `number_std`, `number_var`, `number_vml`, `active`) VALUES (' . $user_id . ', \'' . $db->escape($source) . '\', \'' . $db->escape($case) . '\', \'\', \'\', \'\', \'no\')');
    } else {
        $ok = true;
    }
    # do not allow time rules if no time rules  are defined
    #
    if ($active == 'trl') {
        $id = (int) $db->executeGetOne('SELECT `_user_id` from `cf_timerules` WHERE `_user_id`=' . $user_id);
        if (!$id) {
            return new GsError('No time rules defined. Cannot activate call forward.');
        }
    } else {
        if ($active == 'par') {
            $id = (int) $db->executeGetOne('SELECT `_user_id` from `cf_parallelcall` WHERE `_user_id`=' . $user_id);
            if (!$id) {
                return new GsError('No parsllel call tragets. Cannot activate call forward.');
            }
        }
    }
    # set state
    #
    $ok = $ok && $db->execute('UPDATE `callforwards` SET
	`active`=\'' . $db->escape($active) . '\'
WHERE
	`user_id`=' . $user_id . ' AND
	`source`=\'' . $db->escape($source) . '\' AND
	`case`=\'' . $db->escape($case) . '\'
LIMIT 1');
    if (!$ok) {
        return new GsError('Failed to set call forwarding status.');
    }
    # do not allow an empty number to be active
    #
    if ($active == 'std' || $active == 'var') {
        $field = 'number_' . $active;
        $number = $db->executeGetOne('SELECT `' . $field . '` FROM `callforwards` WHERE `user_id`=' . $user_id . ' AND `source`=\'' . $db->escape($source) . '\' AND `case`=\'' . $db->escape($case) . '\'');
        if (trim($number) == '') {
            $db->execute('UPDATE `callforwards` SET `active`=\'no\' WHERE `user_id`=' . $user_id . ' AND `source`=\'' . $db->escape($source) . '\' AND `case`=\'' . $db->escape($case) . '\'');
            return new GsError('Number is empty. Cannot activate call forward.');
        }
    }
    if ($case === 'always') {
        $filename = '/tmp/gs-' . $user_id . '-' . time() . '-' . rand(10000, 99999) . '.call';
        $call = "Channel: local/toggle@toggle-cfwd-hint\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: toggle-cfwd-hint\n" . "Extension: toggle\n" . "Callerid: {$user} <Toggle>\n" . "Setvar: __user_id=" . $user_id . "\n" . "Setvar: __user_name=" . $user_ext . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __callfile_from_user=" . $user_ext . "\n" . "Setvar: __record_file=" . $filename . "\n";
        $cf = @fOpen($filename, 'wb');
        if (!$cf) {
            gs_log(GS_LOG_WARNING, 'Failed to write call file "' . $filename . '"');
            return new GsError('Failed to write call file.');
        }
        @fWrite($cf, $call, strLen($call));
        @fClose($cf);
        @chmod($filename, 0666);
        $spoolfile = '/var/spool/asterisk/outgoing/' . baseName($filename);
        if (!gs_get_conf('GS_INSTALLATION_TYPE_SINGLE')) {
            $our_host_ids = @gs_get_listen_to_ids();
            if (!is_array($our_host_ids)) {
                $our_host_ids = array();
            }
            $user_is_on_this_host = in_array($_SESSION['sudo_user']['info']['host_id'], $our_host_ids);
        } else {
            $user_is_on_this_host = true;
        }
        if ($user_is_on_this_host) {
            # the Asterisk of this user and the web server both run on this host
//.........这里部分代码省略.........
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:101,代码来源:gs_callforward_activate.php


示例16: fClose

        fClose($handler);
        $signed = false;
        if ($sign === true) {
            shell_exec("cd /srv/bind/ && /usr/sbin/dnssec-signzone -r /dev/urandom -A -N INCREMENT -K /srv/bind/dnssec/" . $zone['soa']['origin'] . "/ -o " . $zone['soa']['origin'] . " -t " . $zone['soa']['origin'] . "db");
            if (file_exists("/srv/bind/" . $zone['soa']['origin'] . "db.signed")) {
                $signed = true;
            }
        }
        $cout = "zone \"" . $zone['soa']['origin'] . "\" {\n";
        $cout .= "\ttype master;\n";
        $cout .= "\tnotify no;\n";
        $cout .= "\tfile \"/srv/bind/" . $zone['soa']['origin'] . "db" . ($signed === true ? ".signed" : "") . "\";\n";
        $cout .= "};\n\n";
        $handler = fOpen("/srv/bind/domains.cfg", "a+");
        fWrite($handler, $cout);
        fClose($handler);
    }
    shell_exec("/etc/init.d/bind9 reload");
}
function getFileName($zone, $algo, $id, $type)
{
    $len = strlen($id);
    if ($len == "1") {
        $id = "0000" . $id;
    } else {
        if ($len == "2") {
            $id = "000" . $id;
        } else {
            if ($len == "3") {
                $id = "00" . $id;
            } else {
开发者ID:cengjing,项目名称:Domain-Control-Panel,代码行数:31,代码来源:bind9.php


示例17: readDataFile

function readDataFile($data_file)
{
    global $node;
    $datafilep = @fOpen($data_file, 'rb');
    if (!$datafilep) {
        write_log("Cannot open {$data_file} for reading! Using cluster data from configuration. This will reset *all* states!");
        return 1;
    }
    $datafilesize = fileSize($data_file);
    $save_struct = @fRead($datafilep, $datafilesize);
    $node = unSerialize($save_struct);
    fClose($datafilep);
}
开发者ID:rkania,项目名称:GS3,代码行数:13,代码来源:gs-cluster-watchdog.php


示例18: writeFile

 public static function writeFile($file, $content)
 {
     $success = false;
     if ($handle = @fOpen($file, "w")) {
         if (fWrite($handle, $content)) {
             $success = true;
             self::log(sprintf(ERR_NONE, self::bold($file)), self::LOG_OK);
         } else {
             self::log(sprintf(ERR_WRITE_FILE, self::bold($file)), self::LOG_ERROR);
         }
         fClose($handle);
     } else {
         self::log(sprintf(ERR_CREATE_FILE, self::bold($file)), self::LOG_ERROR);
     }
     if ($success) {
         @chmod($file, Util::FILE_ACCESS);
     }
     return $success;
 }
开发者ID:saqar,项目名称:aowow,代码行数:19,代码来源:CLISetup.class.php


示例19: readFiles

function readFiles($a)
{
    $fname = explode("/", $a);
    $fnameNums = count($fname);
    $fname = $fname[$fnameNums - 1];
    if (strcmp($fname, "loaddir.php") == 0) {
        echo "<script>alert('不能编辑该文件!');location.href='loaddir.php';</script>";
    }
    //$exts=substr($a,-3);
    $exts = explode(".", $a);
    $extsNums = count($exts);
    $exts = $exts[$extsNums - 1];
    if ($exts == "php" || $exts == "asp" || $exts == "txt" || $exts == "html" || $exts == "aspx" || $exts == "jsp" || $exts == "htm") {
        $handle = @fOpen($a, "r");
        if ($handle) {
            echo "<h3>修改文件:{$a}</h3>";
            echo "<form action='loaddir.php?action=doedit&urlstr={$a}' method='post'><textarea style='width:99%;height:300px;margin-left:auto;margin-right:auto;' name='content'>";
            while (!fEof($handle)) {
                //$buffer=fGets($handle);
                //echo ubb(mb_convert_variables(fGets($handle),"gb2312","gb2312,utf-8"));
                //echo ubb(mb_convert_encoding(fGets($handle),"gb2312","utf-8,gb2312"));
                echo ubb(mb_convert_encoding(fGets($handle), "utf-8", "auto"));
                //echo ubb(iconv("utf-8,gb2312","gb2312",fGets($handle)));
                //echo ubb(fGets($handle));
            }
            fClose($handle);
            echo "</textarea><h3><input type='submit' value='修改' /></h3></form>";
        } else {
            //echo "文件不存在或不可用";
            echo "<script>alert('文件不存在或不可用');location.href='loaddir.php';</script>";
        }
    } else {
        //echo "不能编辑该文件";
        echo "<script>alert('不能编辑该文件');location.href='loaddir.php';</script>";
    }
}
开发者ID:jyyy410team,项目名称:hts,代码行数:36,代码来源:loaddir-old.php


示例20: foreach

            foreach ($pofiles as $pofile) {
                $domain = baseName($pofile, '.po');
                $lang = baseName(dirName(dirName($pofile)));
                /*
                # build .mo file for gettext
                #
                echo "Building $lang $domain.mo ...\n";
                $mofile = preg_replace('/\.po$/', '.mo', $pofile);
                passThru( 'msgfmt -o '. qsa($mofile) .' '. qsa($pofile), $err );
                if ($err !== 0) {
                	echo "  Failed.";
                	if ($err === 127) echo " (msgfmt not found. gettext not installed?)";
                	echo "\n";
                }
                */
                # build .php file for php
                #
                echo "Building {$lang} {$domain}.php ...\n";
                $phpout = _po_to_php($pofile);
                if (!is_array($phpout)) {
                    $phpout = array();
                }
                $phpout = '<' . "?php\n" . "// AUTO-GENERATED FILE. TO MAKE CHANGES EDIT\n" . "// " . $domain . ".po AND REBUILD\n\n" . $copyright . "\n\n" . '$g_gs_LANG[\'' . $lang . '\'][\'' . $domain . '\'] = ' . var_export($phpout, true) . ";\n\n" . '?' . '>';
                $phpfile = preg_replace('/\\.po$/', '.php', $pofile);
                $f = fOpen($phpfile, 'wb');
                fWrite($f, $phpout, strLen($phpout));
                fClose($f);
            }
        }
    }
}
开发者ID:philipp-kempgen,项目名称:amooma-gemeinschaft-pbx,代码行数:31,代码来源:po-to-php.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP fEnd函数代码示例发布时间:2022-05-15
下一篇:
PHP f3函数代码示例发布时间: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