【知识学习】PHP实现批量替换字典后缀

<?php
//要打开字典的物理路径
$filename = 'E:\Local Test\WWW\password.txt';
$handle = fopen($filename,'r') or die('文件打开失败');
//读取字典
$contents = fread($handle,filesize('E:\Local Test\WWW\password.txt'));
fclose($handle);
$text = explode('
',$contents);
foreach($text as $key=>$value){
    //修改要生成的邮箱后缀
    $text[$key] = $value.'@qq.com<br>';
    print_r($text[$key]);
}
?>

posted @ 2017-06-12 22:03  水清云影  阅读(525)  评论(0编辑  收藏  举报