本文整理汇总了PHP中FClose函数的典型用法代码示例。如果您正苦于以下问题:PHP FClose函数的具体用法?PHP FClose怎么用?PHP FClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FClose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Close
public function Close()
{
if ($this->Socket) {
FClose($this->Socket);
$this->Socket = null;
}
}
示例2: Disconnect
public function Disconnect()
{
if ($this->Socket) {
FClose($this->Socket);
$this->Socket = null;
}
}
示例3: _log
private static function _log($data, $level, $withTimestamp)
{
$prependText = $withTimestamp ? date('j.n.Y H:i:s') . ' : ' : '';
if ($level == 'err') {
$fileNameSuffix = '-error';
// naformatovanie dat tak aby boli pekne zarovnane
$sid = str_pad(session_id(), 26, ' ');
$ip = str_pad($_SERVER['REMOTE_ADDR'], 15, ' ');
$prependText .= "SID:{$sid} , IP:{$ip} , ";
} else {
$fileNameSuffix = '';
}
if (is_array($data) || is_object($data)) {
$data = PHP_EOL . var_export($data, true);
}
if (is_bool($data)) {
$data = $data ? 'boolean true' : 'boolean false';
}
try {
$f = FOpen(LOG_DIR . date('Y-m-d') . "{$fileNameSuffix}.txt", "a");
FWrite($f, $prependText . $data . PHP_EOL);
FClose($f);
} catch (Exception $e) {
}
}
示例4: Close
public function Close()
{
if ($this->RconSocket) {
FClose($this->RconSocket);
$this->RconSocket = null;
}
$this->RconRequestId = 0;
}
示例5: Close
public function Close()
{
if ($this->RconSocket) {
FClose($this->RconSocket);
$this->RconSocket = null;
}
$this->RconChallenge = 0;
$this->RconRequestId = 0;
$this->RconPassword = 0;
}
示例6: logg
public function logg($text, $id_uzivatele = null)
{
$fp = FOpen($this->soubor, 'a');
if ($id_uzivatele) {
$osoba = $id_uzivatele;
} else {
$osoba = $this->id_uzivatele;
}
if (!$osoba) {
$osoba = '000000';
}
FPutS($fp, Date("Y-m-d H:i:s") . " gis: {$osoba} " . NStrings::toAscii($text) . "\n");
FClose($fp);
}
示例7: Connect
public function Connect($Ip, $Port = 25565, $Timeout = 3)
{
if ($this->Socket = FSockOpen('udp://' . $Ip, (int) $Port)) {
Socket_Set_TimeOut($this->Socket, $Timeout);
$Challenge = $this->GetChallenge();
if ($Challenge === false) {
FClose($this->Socket);
return false;
}
if (!$this->GetStatus($Challenge)) {
FClose($this->Socket);
return false;
}
FClose($this->Socket);
return true;
} else {
return false;
}
}
示例8: Connect
public function Connect($Ip, $Port = 25565, $Timeout = 3)
{
if (!is_int($Timeout) || $Timeout < 0) {
throw new InvalidArgumentException('Timeout must be an integer.');
}
$this->Socket = @FSockOpen('udp://' . $Ip, (int) $Port, $ErrNo, $ErrStr, $Timeout);
if ($ErrNo || $this->Socket === false) {
throw new MinecraftQueryException('Could not create socket: ' . $ErrStr);
}
Stream_Set_Timeout($this->Socket, $Timeout);
Stream_Set_Blocking($this->Socket, true);
try {
$Challenge = $this->GetChallenge();
$this->GetStatus($Challenge);
} catch (MinecraftQueryException $e) {
FClose($this->Socket);
throw new MinecraftQueryException($e->getMessage());
}
FClose($this->Socket);
}
示例9: SaveUploadedFile
function SaveUploadedFile($Table, $ID, $File)
{
#-------------------------------------------------------------------------------
$FilePaths = GetFilePath($Table, $ID);
#-------------------------------------------------------------------------------
# создаём директорию
if (!File_Exists($FilePaths['FileDir'])) {
if (!MkDir($FilePaths['FileDir'], 0700, true)) {
return new gException('CANNOT_CREATE_DIRECTORY', 'Не удалось создать директорию для сохранения файла');
}
}
#-------------------------------------------------------------------------------
# сохраняем файл
$fp = FOpen($FilePaths['FilePath'], 'w');
FWrite($fp, $File);
FClose($fp);
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
}
示例10: build
private function build($url, $file)
{
// Get content from $url
$curl = curl_init($url);
// Create the file name
$output_file = FOpen($file, 'w');
// Set some headers
curl_setopt($curl, CURLOPT_FILE, $output_file);
curl_setopt($curl, CURLOPT_HEADER, 0);
// Exec the request
curl_exec($curl);
// Print results
echo "<li><a href=\"{$file}\">" . $file . "</a></li>";
/*echo "<pre>";
print_r( curl_getInfo( $curl ) );
echo "</pre>";*/
// Close conection
curl_close($curl);
// Close file
FClose($output_file);
}
示例11: BuildItemDesc
function BuildItemDesc($file)
{
print " * Loading multis config file...\n";
$cfg_file = ReadConfigFile($file);
if ($cfg_file == FALSE) {
print "Cant open {$file} ({$php_errormsg}). Blame Stephen Donald.\n";
exit;
}
print " * Purging itemdesc.cfg for new write...\n";
$handle = FOpen("itemdesc.cfg", "w");
FClose($handle);
$handle = FOpen("itemdesc.cfg", "a");
print " * Finding elem names...";
$elem_names = GetConfigStringKeys($cfg_file, CLASS_LABELS_ON);
print "(" . Count($elem_names) . ")\n";
foreach ($elem_names as $elem_name) {
if (!Preg_Match("/^House\\s+/i", $elem_name)) {
continue;
}
$multi_id = Preg_Replace("/^House\\s+/i", "", $elem_name);
$objtype = HexDec($multi_id);
$objtype += 16384;
// 0x4000
$objtype = "0x" . DecHex($objtype);
FWrite($handle, "House {$objtype}\n");
FWrite($handle, "{\n");
FWrite($handle, "\t// Main Stuff\n");
FWrite($handle, "\tName\t\tHouse{$objtype}\n");
FWrite($handle, "\tGraphic\t\t{$objtype}\n");
FWrite($handle, "\n");
FWrite($handle, "\t// Multi Info\n");
FWrite($handle, "\tMultiID\t\t{$multi_id}\n");
FWrite($handle, "}\n\n");
}
FClose($handle);
return 1;
}
示例12: array
#-------------------------------------------------------------------------------
if (!Is_Resource($Socket)) {
#-------------------------------------------------------------------------------
#Debug(SPrintF('[comp/Tasks/ServersUpTime]: cannot connect %s:%u with error: %s (%s)',$Server['Address'],$Port,$sError,$nError));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$IPage = array('TestDate' => Time(), 'ServerID' => $Server['ID'], 'Service' => Trim($ServiceName), 'UpTime' => Is_Resource($Socket) ? 100 : 0, 'Day' => Date('d'), 'Month' => Date('m'), 'Year' => Date('Y'));
#-------------------------------------------------------------------------------
$IsInsert = DB_Insert('ServersUpTime', $IPage);
if (Is_Error($IsInsert)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (Is_Resource($Socket)) {
FClose($Socket);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
# рассчиытваем значение IsOK
$UpTimes = DB_Select('ServersUpTime', array('(SUM(`UpTime`*`Count`)/SUM(`Count`)) as `UpTime`'), array('UNIQ', 'Where' => SPrintF('`TestDate` > UNIX_TIMESTAMP() - %u * 24 * 60 *60 AND `ServerID` = %u', $Settings['DaysAgregate'] ? $Settings['DaysAgregate'] : 1, $Server['ID'])));
switch (ValueOf($Server)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return ERROR | @Trigger_Error(400);
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
示例13: WriteElemToFile
function WriteElemToFile(&$elem_name, &$elem_lines)
{
$handle = FOpen("CleanedConfig.cfg", "a");
FWrite($handle, "{$elem_name}\n");
FWrite($handle, "{\n");
foreach ($elem_lines as $property => $values) {
foreach ($values as $value) {
FWrite($handle, "\t{$property}\t{$value}\n");
}
}
FWrite($handle, "}\n\n");
FClose($handle);
return 1;
}
示例14: robin_file_write
function robin_file_write($filename_and_path, $data)
{
@umask(0131);
$file = @FOpen($filename_and_path, 'wb+');
@flock($file, 2);
@FPutS($file, $data);
@flock($file, 3);
@FClose($file);
}
示例15: CloseCreate
function CloseCreate()
{
FClose($this->serverLogHandle);
}