且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将文本插入现有文件(在指定行)。

更新时间:2023-11-14 22:11:58




你看过php.net吗?尝试 fopen


Purple
Hi,

did you take a look at php.net ? try fopen

Purple






你看过php吗?网?尝试 fopen


紫色
Hi,

did you take a look at php.net ? try fopen

Purple



fopen用于打开文件

i我正在谈论在任何给定的行上写作

(首先阅读问题)


shoonya

fopen is for opening the file
i am talking about writing on any given line
(read the question first)

shoonya


嘿谢谢重定向问题shoonya,


如果你想操作文件,fopen并不是一个糟糕的起点。如果您按照最初的建议阅读php.net上的页面,您会发现以下代码几乎可以满足您的需求..


以下剪切直接来自php.net - 发布在那里naidim at gmail dot com


虽然PHP没有将文本插入文件中间的功能,但这并不复杂。


[PHP]<?php

函数addRSSItem(
Hey thanks for the redirect to the question shoonya,

fopen is not a bad place to start if you want to manipulate files. If you read the page on php.net as initially suggested you will find the following code which almost does what you want..

The following cut directly from php.net - posted there by naidim at gmail dot com

While PHP does not have a function to insert text into the middle of a file, it is not that complicated to do.

[PHP]<?php
function addRSSItem(