Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP DOM在单选按钮之间添加新行_Php - Fatal编程技术网

PHP DOM在单选按钮之间添加新行

PHP DOM在单选按钮之间添加新行,php,Php,我想在单选按钮之间添加一个新行 我可以向单选按钮添加文本,但“\n”的createTextNode不起作用。。。虽然“\n”显示在HTML上。。。但是“\n”没有也没有掉线 $showXLS = new DOMDocument(); $showXLS->formatOutput = true; $showXLS->preserveWhiteSpace = false; $sXLSSpan = $showXLS->createElement('Span'); $showXLS-

我想在单选按钮之间添加一个新行

我可以向单选按钮添加文本,但“\n”的createTextNode不起作用。。。虽然“\n”显示在HTML上。。。但是“\n”没有也没有掉线

$showXLS = new DOMDocument();

$showXLS->formatOutput = true;
$showXLS->preserveWhiteSpace = false;
$sXLSSpan = $showXLS->createElement('Span');
$showXLS->appendChild($sXLSSpan);
$sXLSSpan->setAttribute('id','saveOptions');
$sXLSSpan->setAttribute('style','VISIBILITY');

$sXLSDiv = $showXLS->createElement('Div');
$sXLSSpan->appendChild($sXLSDiv);
$sXLSDiv->setAttribute('id','showingOptions');
$sXLSDiv->setAttribute('align','right');

$sXLSForm = $showXLS->createElement('Form');
$sXLSDiv->appendChild($sXLSForm);
$sXLSForm->setAttribute('id','sXLSForm');
$sXLSForm->setAttribute('action','printTest.php');
$sXLSForm->setAttribute('method','POST');

$sXLSInput1Text = $showXLS->createElement('label','<b>Save Directory</b>');
$sXLSForm->appendChild($sXLSInput1Text);
$sXLSInput1Text->appendChild($showXLS->createTextNode("\n"));


$sXLSInput1 = $showXLS->createElement('input');
$sXLSInput1Text->appendChild($sXLSInput1);
$sXLSInput1->setAttribute('type','radio');
$sXLSInput1->setAttribute('name','save');
$sXLSInput1->setAttribute('value','saveDirectory');
$sXLSInput1->setAttribute('id','saveDirectory');


$sXLSInput2Text = $showXLS->createElement('label','Save Email');
$sXLSForm->appendChild($sXLSInput2Text);
$sXLSInput2Text->appendChild($showXLS->createTextNode("\n"));

或 createElement(“br”);

\n在html中没有任何值

html不支持\r和\n换行符。它们被视为相同的空格字符。您需要使用html分隔符:

$br=$showXLS->createElement('br');是的,非常感谢你,hendr1x真是省时啊。当我在谷歌上搜索时,他们告诉我用createTextNode来做。
$sXLSInput2 = $showXLS->createElement('input');
$sXLSInput2Text->appendChild($sXLSInput2);
$sXLSInput2->setAttribute('type','radio');
$sXLSInput2->setAttribute('name','save');
$sXLSInput2->setAttribute('value','saveEmail');
$sXLSInput2->setAttribute('onClick','getMore()');
<br/>
or
createElement("br");