php导出数据到txt中 我在php中写查询,查到个人的email,想把它导入到txt中,请问哪位高人有例子共享下,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 取出来,拼凑成串,然后用file_put_contents()函数写入文件. 这种问题,Google一下,你就知道。 <?phpfunction get_emailaddress(){ return "[email protected]" ;}function save_emailaddress($email) { $fp = fopen('email.txt','a+'); if(!$fp) return ; fputs($fp,$email."\r\n"); fclose($fp);}//生成email$email = get_emailaddress();//写email到文件save_emailaddress($email);?>楼主好歹也是三颗星 当然是用最通用的CSV格式...<?php$list = array ( 'aaa,bbb,ccc,dddd', '123,456,789', '"aaa","bbb"');$fp = fopen('file.csv', 'w');foreach ($list as $line) { fputcsv($fp, split(',', $line));}fclose($fp);?> PHP Manual $file_ending = "txt";header("Content-Type: application/$file_type");header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=$dbTablename.$file_ending");header("Pragma: no-cache");header("Expires: 0");....... $file_ending = "txt";header("Content-Type: application/$file_type");header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=$dbTablename.$file_ending");header("Pragma: no-cache");header("Expires: 0");....... 问号传参问题 一段PHP的分页程序,报错 关于PHP中函数的返回值的问题 ACityName1=%u4e39%u4e1c 这个等号后面的是什么啊? php mysql 有没有在烟台的搞PHP的朋友 关于多语言版本的问题! php文件写进htm文件,成功后内容乱七八糟,何解? 关于PEAR的一个小问题。 php中如何将我点击得文字作为参数传到下一个页面呢 如何用php读取txt文件,根据内容动态创建数据库? ie浏览器刷新有点问题
function get_emailaddress(){
return "[email protected]" ;
}function save_emailaddress($email) {
$fp = fopen('email.txt','a+');
if(!$fp) return ;
fputs($fp,$email."\r\n");
fclose($fp);
}
//生成email
$email = get_emailaddress();
//写email到文件
save_emailaddress($email);
?>楼主好歹也是三颗星
<?php$list = array (
'aaa,bbb,ccc,dddd',
'123,456,789',
'"aaa","bbb"'
);$fp = fopen('file.csv', 'w');foreach ($list as $line) {
fputcsv($fp, split(',', $line));
}fclose($fp);
?>
PHP Manual
header("Content-Type: application/$file_type");
header("Accept-Ranges: bytes");
header("Content-Disposition: attachment; filename=$dbTablename.$file_ending");
header("Pragma: no-cache");
header("Expires: 0");.
.
.
.
.
.
.
header("Content-Type: application/$file_type");
header("Accept-Ranges: bytes");
header("Content-Disposition: attachment; filename=$dbTablename.$file_ending");
header("Pragma: no-cache");
header("Expires: 0");.
.
.
.
.
.
.