English 中文(简体)
处理PHP中的阅读/书写档案?
原标题:Handling Reading/Writing Files in PHP?
  • 时间:2012-01-15 08:41:11
  •  标签:
  • php
  • file

这是自我接触过PHP以来的一段时期,我曾一度在C#中工作。 我需要做一些读/写,但我不敢确定何时开始。 视力演练室的成像和实时的错误核对使我变坏了,因此很难用这种软弱的语言。

在购买力平价中,阅读档案时返回了什么,书写时需要写什么?

I need to work with the file in hex, but decimal would be fine too. Is there any way to read it in any way but a string?

最佳回答

阅读和书写档案有几种方式:

您可通过f open(功能。

The other way is just file_get_contents(), this function just returns content. And file_put_contents() just put any data to file.

作为手工业者的例子,这里的伐木 st:

    if (!is_writable($this->file) && $name !== self::CORE_LOG)
    {
        self::getInstance(self::CORE_LOG)->log(sprintf( Couldn t write to file %s. Please, check file credentials. , $name));
    }
    else
    {
        $this->handler = fopen($this->file,  a+ );
        self::$instances[$name] = &$this;
    }
...

    if ($this->handler)
        fwrite($this->handler,  [  . date( r ) .  ] :   . $l . "
");
...

    if ($this->handler)
        fclose($this->handler);

Here

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签