Mình có dữ liệu là file txt trong đó có nhiều dòng trùng lặp, mình muốn xóa hết và chỉ giữ lại 1 dòng vậy xin hỏi code php thế nào để làm được điều đó. Thanks
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Hoàng Anh
Bạn thử code sau:
$lines = file('file.txt');
$lines = array_unique($lines);
file_put_contents('file.txt', implode($lines));