我在“威治一”中设有一个网站,可以管理文章。 在添加新的条款表格时,我只想限制特性投入。 我在服务器边使用strlen(<<><>>><><><>方法进行核对。
问题在于<条码>。 看来,提供数目太大。 我尝试使用html_entity_decode( 文件<>,使html的标签摆脱了扼杀,但所造成的扼杀时间似乎是错误的。
我在“威治一”中设有一个网站,可以管理文章。 在添加新的条款表格时,我只想限制特性投入。 我在服务器边使用strlen(<<><>>><><><>方法进行核对。
问题在于<条码>。 看来,提供数目太大。 我尝试使用html_entity_decode( 文件<>,使html的标签摆脱了扼杀,但所造成的扼杀时间似乎是错误的。
html_entity_decode
only decodes HTML entities, it doesn t ignore HTML tags. Try:
strlen(strip_tags(html_entity_decode($string)));
或多面当量:
mb_strlen(strip_tags(html_entity_decode($string)), auto );
你们想要获得一些特性,但你不想计算超文本标记。
您可以通过使用超文本格式,如
$doc = new DOMDocument();
$doc->loadHTMLFile( test.html );
$body = $doc->getElementsByTagName( body )->item(0);
$text = $body->nodeValue;
$text = trim(preg_replace( /s{1,}/u , , $text));
printf("Length: %d character(s).
", mb_strlen($text, utf-8 ));
例输入<代码>test.html:
<body>
<div style= float:left ><img src= ../../../../includes/ph1.jpg ></div>
<label style= width: 476px; height: 40px; position: absolute;top:100px; left: 40px; z-index: 2; background-color: rgb(255, 255, 255);; background-color: transparent >
<font size="4">1a. Nice to meet you!</font>
</label>
<img src= ENG_L1_C1_P0_1.jpg style= width: 700px; height: 540px; position: absolute;top:140px; left: 40px; z-index: 1; />
<script type= text/javascript >
swfobject.registerObject( FlashID );
</script>
<input type="image" id="nextPageBtn" src="../../../../includes/ph4.gif" style="position: absolute; top: 40px; left: 795px; ">
</body>
例产出:
Length: 58 character(s).
正常案文是:
1a. Nice to meet you! swfobject.registerObject( FlashID );
注意,案文的大小包括以下文字:<代码><script>tags。
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!