Home > Backend Development > PHP Tutorial > 为何php解析后会出现换行

为何php解析后会出现换行

WBOY
Release: 2016-06-13 13:14:05
Original
842 people have browsed it

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

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->

public function javascript()
     {
          ?>
          <script type="text/javascript">
          function init_meet()
          {
               var cr = new Array();

               <?
               if($this->data != null)
               {
                    foreach($this->data as $i)
                    {                    
               ?>
                         name = "<?php echo $i["code"]; ?>";
                         cr[name]            = new Array();
                         cr[name]["code"]    = '<?=$i["code"]?>';
               <?
                    }
               }     
               ?>
               return cr;
          }
          </script>     
           
     }
     
Copy after login


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

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
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;
Copy after login

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

------解决方案--------------------
试试
------解决方案--------------------
那是因为你原始的数据中有换行符
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template