热搜:NVER 

为何php解析后会出现换行

2024-04-26 18:58:01
 为何php解析后会出现换行

为什么php解析后会出现换行

PHP code


public function javascript()
     {
          ?>
           
     }
     


这段代码解析后,只要是php部分的都换了行
HTML code

var cr = new Array();

                                        name = "2001
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2001
';
                                        name = "2002
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2002
';
                                        name = "2003
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2003
';
                                        name = "2004
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2004
';
                                        name = "2005
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2005
';
                                        name = "2006
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2006
';
                                        name = "2007
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2007
';
                                        name = "2008
";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '2008
';
                              return cr;

是什么情况呢,我在本地机上不是这样的,在虚拟机就呈现这样了,哪位大大解惑!!!

------解决方案--------------------
试试 <?php echo trim($i["code"]); ?>
------解决方案--------------------
那是因为你原始的数据中有换行符