php高手进 速度给分...指点即可

来源:百度知道 编辑:UC知道 时间:2024/07/04 11:40:28
用一php文件实现对指定路径下指定文件(如 d:/www/1.php) 的第2行插入一行代码 原第2行变第3行. 就这些!
当然最好php中有三个文本框(分别输入自定义文件路径,自定义第几行,自定义的一行代码).

小弟初学php 大侠指点一下即可.什么函数等. 当然最好写个代码.
测试ok,立马上分!

<form action="./InsertText.php" method="post" name="login" id="login" >

filePathAndName<input type="text" name="filePathAndName"/><BR>
fileLine       <input type="text" name="fileLine"/><BR>
fileText       <input type="text" name="fileText"/><BR>
<input type="submit" name="Submit" value="submit">
</form>
<?php
/**
$filePathAndName = "./temp.php";
$fileLine = 2;
$fileText = "echo 'aaaaaaaaaaaa';"."\r\n";
**/
$filePathAndName = $_POST["filePathAndName"];
$fileLine = $_POST["fileLine"];
$fileText = $_POST["fileText"]."\r\n";
$fileArray = file($filePathAndName);<