我实际上在网上找不到任何答案。在编码方面,我一直在网上搜索答案。那么..PHP替换文件中的特定行
我想知道如何在PHP中使用别的东西来更改文件中的特定行?
我有4行看起来像这样:
$2y$10$hashedpassword
typewar
typewarMMM36634573323
84.2xx.xxx.xxx
我最近已经开始寻找到饼干,这些东西,并希望能够更改cookie(3号线),每当到了人的日志服务器或去index.php
我猜这样的事情?
$user = 'typewar';
$GeneratedCookie = $user . 'MMM' . date('H', time()) * date('i', time()) * 333;
$lines = file('/path/to/identity/' . $user . '/identity.txt');
str_replace($lines[2], $GeneratedCookie . '/n');
请帮忙。
当您尝试该代码时会发生什么? –
@AndrewMortimer没有线索,因为这只是我认为代码可能看起来像的一个例子。我有一段时间挣扎着,我不想再测试这个了。哈哈 – Typewar