简体   繁体   English

substr函数显示空白页

[英]substr function displaying a blank page

I am trying to use substr function in PHP for the below html string 我正在尝试在PHP中将substr函数用于以下html字符串

<HR><CENTER><B>References <a href="aaaa">[Referenced By]</A></B></CENTER>       <HR>
         <CENTER><b>Documents</b></CENTER>
<TABLE WIDTH="100%"> <TR><TH scope="col" WIDTH="33%"></TH> <TH scope="col" WIDTH="33%"></TH> <TH scope="col" WIDTH="34%"></TH></TR> <TR> <TD ALIGN="left">

$html is the variable that includes the string above, and my code as below $ html是包含上面字符串和下面代码的变量

$ints = strpos($html,"<b>Documents</b></CENTER>");
$ii=strlen("<b>Documents</b></CENTER>");

echo substr($html,$ints + $ii+2,7);

this is working very well with me and I got result 这对我来说很好用,我得到了结果

TABLE W 

but when I tried to write the echo as below I have a blank page with no errors 但是当我尝试如下编写回显时,我有一个空白页面,没有错误

echo substr($html,$ints + $ii,7);

any suggestion what is wrong? 有什么建议吗? is the starting of the new line is the reason? 是新线开始的原因吗? appreciate your help and if you have any solution. 感谢您的帮助,如果您有任何解决方案。

You're not getting a blank page. 您没有得到空白页。 You're probably getting a rendered HTML page that happens to contain <TABLE . 您可能会得到一个恰好包含<TABLE的呈现的HTML页面。 Do a 'view source' to confirm. 做一个“查看源代码”进行确认。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM