Home >php教程 >php手册 >PHP用echo语法向输出长字符串产生空行的问题

PHP用echo语法向输出长字符串产生空行的问题

WBOY
WBOYOriginal
2016-06-06 19:57:321027browse

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 问题: php中用echo方法向网页中输出长字符串产生空行怎么办啊 dutyList[2]=[new Array("教质主任","9"),new Array("教质副主任","10"),new Array("班主任","11"),new Array("教务","12")]; dutyList

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

   问题:

   php中用echo方法向网页中输出长字符串产生空行怎么办啊

   dutyList[2]=[new Array("教质主任","9"),new Array("教质副主任","10"),new Array("班主任","11"),new Array("教务","12")];
   dutyList[3]=[new Array("招生办主任","1"),new Array("招生办副主任","2"),new Array("咨询师","3"),new Array("网络咨

   询师","4"),new Array("咨询助理","5"),new Array("媒体专员","6"),new Array("品牌宣传专员","7"),new Array("区域主管","8")];
   如上面代码所示,我用php动态生成js代码,短的字符串输出没问题,长字符串dutyList[3]输出到页面就产生了空行造成js不能运行,请团长指教啊!

    回答:

   不是ECHO的问题,你PHP代码里面本身就有换行符吧。
   new Array("网络咨

   询师","4"),
   这里本身就有换行符在里面。我平常用ECHO输出整个网页都不会出现多余的空行。

PHP用echo语法向输出长字符串产生空行的问题

Statement:
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