<?php $filename = 'file.txt'; $word = "你好!\r\nwebkaka"; //双引号会换行 单引号不换行 file_put_contents($filename, $word); ?>