本文整理汇总了PHP中Import::build_example_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Import::build_example_file方法的具体用法?PHP Import::build_example_file怎么用?PHP Import::build_example_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Import
的用法示例。
在下文中一共展示了Import::build_example_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
$valuestarget = $objimport->array_import_examplevalues[0];
$attachment = true;
if (isset($_GET["attachment"])) {
$attachment = $_GET["attachment"];
}
//$attachment = false;
$contenttype = dol_mimetype($format);
if (isset($_GET["contenttype"])) {
$contenttype = $_GET["contenttype"];
}
//$contenttype='text/plain';
$outputencoding = 'UTF-8';
if ($contenttype) {
header('Content-Type: ' . $contenttype . ($outputencoding ? '; charset=' . $outputencoding : ''));
}
if ($attachment) {
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
// List of targets fields
$headerlinefields = array();
$contentlinevalues = array();
$i = 0;
foreach ($fieldstarget as $code => $label) {
$withoutstar = preg_replace('/\\*/', '', $fieldstarget[$code]);
$headerlinefields[] = $langs->transnoentities($withoutstar) . ($withoutstar != $fieldstarget[$code] ? '*' : '') . ' (' . $code . ')';
$contentlinevalues[] = $valuestarget[$code];
}
//var_dump($headerlinefields);
//var_dump($contentlinevalues);
print $objimport->build_example_file($format, $headerlinefields, $contentlinevalues, $datatoimport);
示例2:
$fieldstarget=$objimport->array_import_fields[0];
$valuestarget=$objimport->array_import_examplevalues[0];
$attachment = true;
if (isset($_GET["attachment"])) $attachment=$_GET["attachment"];
//$attachment = false;
$contenttype=dol_mimetype($format);
if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"];
//$contenttype='text/plain';
$outputencoding='UTF-8';
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:''));
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
// List of targets fields
$headerlinefields=array();
$contentlinevalues=array();
$i = 0;
foreach($fieldstarget as $code=>$label)
{
$headerlinefields[]=$fieldstarget[$code].' ('.$code.')';
$contentlinevalues[]=$valuestarget[$code];
}
//var_dump($headerlinefields);
//var_dump($contentlinevalues);
print $objimport->build_example_file($user,$format,$headerlinefields,$contentlinevalues);
?>