Home Backend Development PHP Tutorial php的io操作解决思路

php的io操作解决思路

Jun 13, 2016 pm 01:36 PM
msg quot system

php的io操作

C# code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
 public static void WriteLog(string msg) {
            using (System.IO.StreamWriter reader = new System.IO.StreamWriter(System.Web.HttpContext.Current.Server.MapPath("~/log.txt"), true, Encoding.UTF8)) {
                reader.WriteLine(msg + "\t" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            }
        }

 

Copy after login


我绝望了 不设断点了 写在记事本算了 

php的io不熟 那位大侠把这个转成等效的php代码啊

------解决方案--------------------
file_put_contents( realpath('~/log.txt'), $msg . date('Y-m-d H:i:s));

------解决方案--------------------

代码很简洁啊
------解决方案--------------------
探讨

file_put_contents( realpath('~/log.txt'), $msg . date('Y-m-d H:i:s));

------解决方案--------------------
探讨
文件不存在不会自动创建?
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Java documentation interpretation: Usage analysis of the currentTimeMillis() method of the System class Java documentation interpretation: Usage analysis of the currentTimeMillis() method of the System class Nov 03, 2023 am 09:30 AM

Java document interpretation: Usage analysis of the currentTimeMillis() method of the System class, specific code examples are required. In Java programming, the System class is a very important class, which encapsulates some properties and operations related to the system. Among them, the currentTimeMillis method is a very commonly used method in the System class. This article will explain the method in detail and provide code examples. 1. Overview of currentTimeMillis method

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Win10 blue screen error: System service exception Win10 blue screen error: System service exception Dec 29, 2023 pm 04:04 PM

The win10 system is a very easy-to-use and highly intelligent system. Its strong compatibility can ensure that the system will basically not have any problems during normal use. However, as people continue to use the win10 system, sometimes the system will also have problems. The problem of Win10 booting blue screen termination code SystemServiceException. Today I will bring you the solution to Win10 booting Blue Screen termination code SystemServiceException. If you need it, please download it quickly. Solution to win10systemserviceexception blue screen: Method 1: 1. Use Windows key + R to open Run and enter “contr

What currency is MSG? Is MSG coin worth investing in? What currency is MSG? Is MSG coin worth investing in? Feb 21, 2024 pm 05:28 PM

What currency is MSG? MSG is a cryptocurrency, whose full name is MessageCoin. It is a digital currency based on blockchain technology and has the characteristics of decentralization, anonymity and security. MSG's mission is to promote secure and efficient peer-to-peer communication and value transfer on a global scale. Is MSG Coin worth investing in? Investing in MSG Coin requires comprehensive consideration of multiple factors, including market prospects, technical strength and team background. The market potential of MSG coins has attracted much attention. As the cryptocurrency industry develops rapidly, global demand for decentralized communications and payments continues to rise. As a digital currency focusing on communication and value transfer, MSG has a wide range of application prospects. The technical strength of MSG coin is also one of the important factors that attracts users.

What is the computer system? What is the computer system? Feb 22, 2023 am 10:25 AM

The computer system is a relatively common system process. You will often see system when viewing the process. This process simply means the computer system; however, if the system.exe process appears on the computer, it needs to be deleted in time. , this is a file generated by a Trojan horse virus. There is no exe suffix behind the real system.

How to use Object class and System class in Java? How to use Object class and System class in Java? Apr 23, 2023 pm 11:28 PM

Object is the base class of all Java classes, the top of the entire class inheritance structure, and the most abstract class. Everyone uses toString(), equals(), hashCode(), wait(), notify(), getClass() and other methods every day. Maybe they don’t realize that they are methods of Object, and they don’t look at what other methods Object has. And think about why these methods should be placed in Object. 1. Introduction to JavaObject class - the super class of all classes Object is a special class in the Java class library and is also the parent class of all classes. In other words, Java allows any type of object to be assigned to the Object type

windows7 english version system download windows7 english version system download Jul 15, 2023 pm 07:45 PM

I believe that netizens are very familiar with the Windows 7 system. Have you heard of the Windows 7 English version system? I believe that many netizens have heard about the Windows 7 English version system. However, some friends are looking for the Windows 7 English version system to download. Today I will The editor is going to share the introduction of the original version of win7 in English with everyone, so that netizens can understand the original version of win7 in English. The following is to tell you where to download the English version of Windows 7 system. The original English system of win7 has been released to MSDN for subscription download. The official English integrated version was first released, Windows7WithSP1, which is the Windows7 CD image with integrated SP1. Includes SP1 standalone for multiple languages

Microsoft announces general availability of System Center 2022 Microsoft announces general availability of System Center 2022 Apr 14, 2023 am 09:40 AM

Microsoft has announced the availability of System Center 2022. The latest version brings System Center Operations Manager (SCOM), Virtual Machine Manager (VMM), System Center Orchestrator (SCORCH), Service Manager (SM) and Data Protection Manager

See all articles