Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use fwrite in php

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to use fwrite in php". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use fwrite in php".

The function fwrite in php writes the contents to an open file, using syntax such as "fwrite (file,string,length)", where the parameter file specifies the open file to be written, and the parameter string specifies the string to be written to the open file.

This article operating environment: Windows7 system, PHP7.4 version, Dell G3 computer.

What is the use of fwrite in php?

PHP fwrite () function

Definition and usage

The fwrite () function writes the contents to an open file.

The function stops running when it reaches the specified length or reads to the end of the file (EOF), whichever comes first.

If the function executes successfully, it returns the number of bytes written. If it fails, FALSE is returned.

Grammar

Fwrite (file,string,length)

Parameters.

File is required. Specifies the open file to write to.

String is required. Specifies the string to write to the open file.

Length is optional. Specifies the maximum number of bytes to write.

Tips and comments

Tip: this function is binary safe. (meaning that both binary data (such as images) and character data can be written using this function. )

Example

The above code will output:

Thank you for your reading, the above is the content of "how to use fwrite in php". After the study of this article, I believe you have a deeper understanding of how to use fwrite in php, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report