file_put_contents $ip:$port - 如何在一行中获取结果


file_put_contents("kris.txt", "$ip:$portn",FILE_APPEND);

创建

127.0.0.1
:1575

而不是

127.0.0.1:1575

我想在一行中得到结果 127.0.0.1:1575 [IP:PORT]

127.0.0.1:7575
127.0.0.1:1575
127.0.0.1:4574
127.0.0.1:6554

而不是

127.0.0.1
:7575
127.0.0.1
:1575
127.0.0.1
:4574
127.0.0.1
:6554

看起来$ip末尾包含一个换行符。要摆脱它,trim $ip变量。

file_put_contents("kris.txt", trim($ip) . ":$portn",FILE_APPEND);

最新更新