के अंदर मान को बंद करें, मैं टैब के साथ इंपोडिंग से पहले टैग को array_values () के अंदर मान को बंद करना चाहता हूं।PHP: टैग को array_values ()
मैं नीचे इस लाइन के साथ करने की कोशिश की लेकिन मुझे एक त्रुटि है,
$output = implode("\t",strip_tags(array_keys($item)));
आदर्श मैं पंक्ति विराम, डबल रिक्त स्थान, मूल्य से टैब बंद पट्टी करना चाहते हैं,
$output = implode("\t",preg_replace(array("/\t/", "/\s{2,}/", "/\n/"), array("", " ", " "), strip_tags(array_keys($item))));
लेकिन मैं सोचो मेरी विधि सही नहीं है!
इस पूरे समारोह है,
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));
$output .= "\n";
}
# create a line of values for this row...
$output .= implode("\t",array_values($item));
$output .= "\n";
# increment the row so we don't create headers all over again
$row++;
}
}
}
# return the result
return $output;
}
कृपया मुझे पता है अगर आप किसी भी विचार है कि यह कैसे तय करने के लिए करते हैं। धन्यवाद!
इस के लिए बहुत बहुत धन्यवाद! इस फ़ंक्शन का उपयोग एक्सेल फ़ाइलों को निर्यात करने के लिए किया जाता है। लेकिन जब कीमत में टैग, लाइन ब्रेक इत्यादि होते हैं तो यह 'बग' का कारण बनता है। – laukok