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);