0
我想要做的是使我的输出可用于电子表格。恼人的数组标签..想要一个漂亮的输出
我希望输出中的每个项目不带数组变量或不混合在一起,但以星号开头并以%符号结尾。
<?php
$file = file_get_contents('aaa.txt'); //get file to string
$row_array = explode("\n",$file); //cut string to rows by new line
$row_array = array_count_values(array_filter($row_array));
foreach ($row_array as $key=>$counts) {
if ($counts==1)
$no_duplicates[] = $key;
}
//do what You want
echo '<pre>';
print_r($no_duplicates);
//write to file. If file don't exist. Create it
file_put_contents('no_duplicates.txt',$no_duplicates);
?>
你能告诉我们你想看到输出的例子吗? –
*“可用于电子表格的输出”* - 使用http://php.net/fputcsv –
* item1%* item2%* item3%等等........ –