我想在使用制表符进行内爆之前从array_values()内部的值中删除标记.
我试过下面的这一行,但是我有一个错误,
$output = implode("\t",strip_tags(array_keys($item)));
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想剥离换行符,双倍空格,值的标签,
$output = implode("\t",preg_replace(array("/\t/", "/\s{2,}/", "/\n/"), array("", " ", " "), strip_tags(array_keys($item))));
Run Code Online (Sandbox Code Playgroud)
但我认为我的方法不正确!
这是整个功能,
function process_data($items){
# set the variable
$output = null;
# check if the data is an items and is not empty
if (is_array($items) && !empty($items))
{
# start the row at 0
$row = 0;
# loop the items
foreach($items as $item)
{
if (is_array($item) && !empty($item))
{
if ($row == 0)
{
# write the column headers
$output = implode("\t",array_keys($item)); …Run Code Online (Sandbox Code Playgroud)