可以在写入文件前,先读取已有的内容,然后判断是否已经存在相同的链接地址,如果存在则不写入,否则写入。

修改后的代码如下:

phpwhiletrue $url = httpaplbttqxyzsjpngapitextphp; $text = file_get_contents$url; $filename = sptxt; $handle = fopen$filename a+; $contents = fread$handle filesize$filename; ifstrpos

原文地址: https://www.cveoy.top/t/topic/cfj8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录