如何在运行时删除空白? [英] How to remove blanks at runtime??

查看:78
本文介绍了如何在运行时删除空白?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法自动删除发送给客户端的html

中的所有空白字符?


示例:

------------------------------------------------ ----------------

< ;?

echo" HTML tags here< br>" ;

?>

更多HTML在这里

< div>

< div>

一些文字

< / div>

< / div>


<?

-------------------------------------------- --------------------


运行此脚本后,客户端应该收到:

-------------------------------------------------- --------------

HTML标签在这里< br>

更多HTML在这里

< div> ;

< div>

一些文字

< / div>

< / div>

------------------------------------------- ---------------------


PHP中是否有任何选项可以自动执行此操作?


提前致谢。

Is there any way to remove automatically all blank chars from the html
sent to the client??

Example:
----------------------------------------------------------------
<?
echo "HTML tags here<br>" ;
?>
more HTML here
<div>
<div>
Some text
</div>
</div>

<?
----------------------------------------------------------------

after running this php script the client should receive:
----------------------------------------------------------------
HTML tags here<br>
more HTML here
<div>
<div>
Some text
</div>
</div>
----------------------------------------------------------------

Is there any option in PHP to do this automatically??

Thanks in advance.

推荐答案

2006年10月7日14:51:36 -0700,他************* @ gmail.com 写道:
On 7 Oct 2006 14:51:36 -0700, He*************@gmail.com wrote:

>有没有办法自动删除发送给客户端的所有空白字符?

示例:
------------- -------------------------------------------------- -
< ;?
回显此处的HTML标记< br>" ;
?>
更多HTML在这里
< div>
< div>
一些文字
< / div>
< / div>

<?
------------------------------ ----------------------------------

运行这个PHP脚本后,客户端应该收到:
-------------------------------------------- --------------------
这里有HTML标签< br>
此处有更多HTML
< div>
< ; div>
一些文字
< / div>
< / div>
------------------- ---------------------------------------------

PHP中有任何选项可以自动执行此操作吗?
>Is there any way to remove automatically all blank chars from the html
sent to the client??

Example:
----------------------------------------------------------------
<?
echo "HTML tags here<br>" ;
?>
more HTML here
<div>
<div>
Some text
</div>
</div>

<?
----------------------------------------------------------------

after running this php script the client should receive:
----------------------------------------------------------------
HTML tags here<br>
more HTML here
<div>
<div>
Some text
</div>
</div>
----------------------------------------------------------------

Is there any option in PHP to do this automatically??



不是内置的,但你可以使用输出缓冲并修改缓冲区的内容,因为它的输出。< > http://uk2.php .net / manual / zh / ref.outcontrol.php


-

Andy Hassall :: 一个** @ andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space ::磁盘和FTP使用情况分析工具

Not built-in, but you could use output buffering and modify the contents of
the buffer as it''s output.

http://uk2.php.net/manual/en/ref.outcontrol.php

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool


谢谢。


如果我使用输出是否有任何性能影响或服务器重载

缓冲?


是否需要更多资源(cpu,ram) )10月7日下午6:59,Andy Hassall< a ... @ andyh.co.ukwrote:
Thanks.

Is there any performance impact or server overloading if I use output
buffering??

Does it take more resources (cpu, ram)??

On Oct 7, 6:59 pm, Andy Hassall <a...@andyh.co.ukwrote:

2006年10月7日14:51:36 -0700,Hermann.Rich ... @ gmail.com写道:


On 7 Oct 2006 14:51:36 -0700, Hermann.Rich...@gmail.com wrote:



有没有任何方法从html中自动删除所有空白字符

发送给客户端?
Is there any way to remove automatically all blank chars from the html
sent to the client??


例如:

-------------------- --------------------------------------------

< ;?

echo"这里的HTML标签< br>" ;

?>

更多HTML在这里

< div>

< div>

一些文字

< / div>

< / div>
Example:
----------------------------------------------------------------
<?
echo "HTML tags here<br>" ;
?>
more HTML here
<div>
<div>
Some text
</div>
</div>


< ;?

------------------- ---------------------------------------------
<?
----------------------------------------------------------------


运行此脚本后客户端应该收到:

----------------- -----------------------------------------------

HTML标签在这里< br>

更多HTML在这里

< div>

< div>

一些文字

< / div>

< / div>

---------- -------------------------------------------------- ----
after running this php script the client should receive:
----------------------------------------------------------------
HTML tags here<br>
more HTML here
<div>
<div>
Some text
</div>
</div>
----------------------------------------------------------------


PHP中是否有任何选项可以自动执行此操作?不是内置的,但你可以使用输出缓冲并修改
的内容
Is there any option in PHP to do this automatically?? Not built-in, but you could use output buffering and modify the contents of



缓冲区的输出。

< a rel =nofollowhref =http://uk2.php.net/manual/en/ref.outcontrol.phptarget =_ blank> http://uk2.php.net/manual/en/ref .outcontrol.php


-

Andy Hassall :: a ... @ andyh.co.uk :: http://www.andyh.co.ukhttp: //www.and....co.uk/space :: 磁盘和FTP使用情况分析工具 - 隐藏引用的文字 - 显示引用的文字 -

the buffer as it''s output.

http://uk2.php.net/manual/en/ref.outcontrol.php

--
Andy Hassall :: a...@andyh.co.uk ::http://www.andyh.co.ukhttp://www.and....co.uk/space:: disk and FTP usage analysis tool- Hide quoted text -- Show quoted text -


来自''s消息。 。 。
Following on from ''s message. . .

>谢谢。

如果我使用输出
缓冲,是否有任何性能影响或服务器重载?
是否需要更多资源(cpu,ram)?
>Thanks.

Is there any performance impact or server overloading if I use output
buffering??

Does it take more resources (cpu, ram)??



缓冲和处理

缓冲区时,绝对没有开销。为什么会这样?这不像是你在使用RAM或CPU

周期。


如果你动态生成输出,那么清除那些空格

源代码。


如果您只是提供HTML,那么整理原始HTML一次。

-

PETER FOX自从电子商务业务出现以来不一样。
pe ****** @ eminent.demon.co.uk.not.this.bit.no.html

2 T恤关闭,埃塞克斯郡Witham。

埃塞克斯的重力啤酒< http://www.eminent.demon.co.uk>

No there is absolutely no overhead when buffering and processing the
buffer. Why should that be? It''s not as if you''re using RAM or CPU
cycles.

If you''re generating the output dynamically then clear out those spaces
in the source code.

If you are just serving HTML then tidy up the original HTML once.
--
PETER FOX Not the same since the e-commerce business came to a .
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>


这篇关于如何在运行时删除空白?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆