Home  >  Article  >  Backend Development  >  怎么用PHP实现数据库导出到txt文件或csv文件

怎么用PHP实现数据库导出到txt文件或csv文件

WBOY
WBOYOriginal
2016-06-13 10:57:311447browse

如何用PHP实现数据库导出到txt文件或csv文件
rt

------解决方案--------------------
while($r=mysql_fetch_assoc($rs)) {
file_put_contents('文件名', '"' . join('","', $r) . '"' .PHP_EOL, FILE_APPEND);
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn