[英]Html tag not working in php
I have started learning php.我已经开始学习php了。 So far i have been using the notepad to run the php codes.
到目前为止,我一直在使用记事本来运行 php 代码。 Recently I just downloaded phpstorm.
最近我刚刚下载了phpstorm。 In this ide, when I use html tags, it just gets printed out.
在这个ide中,当我使用html标签时,它只是被打印出来。 The break tags inside echo are not printing new lines.
echo 中的中断标签不打印新行。 it prints
"<br>"
For example:它打印
"<br>"
例如:
$food = array('Pasta'=>1, 'Burger'=>2, 'Noodles'=>3, 'Rice'=>4);
ksort($food);
foreach($food as $keyname => $valName){
echo $valName.$keyname."<br>";
}
this becomes the output:这成为输出:
2Burger<br>3Noodles<br>1Pasta<br>4Rice<br>
I went to the filetype and changed assigned *.html5 to php.我转到文件类型并将分配的 *.html5 更改为 php。 Still the same outcome.
结果还是一样。 Any suggestions?
有什么建议?
It seems you want to print each time in new line, you can use "\\n"
..eg似乎您想每次都在新行中打印,您可以使用
"\\n"
..eg
<?php
$food = array('Pasta'=>1, 'Burger'=>2, 'Noodles'=>3, 'Rice'=>4);
ksort($food);
foreach($food as $keyname => $valName){
echo $valName.$keyname."\n";
}
?>
Try this-尝试这个-
$food = array('Pasta'=>1, 'Burger'=>2, 'Noodles'=>3, 'Rice'=>4);
ksort($food);
foreach($food as $keyname => $valName){
echo $valName.$keyname."<br/>";
}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.