简体   繁体   English

如何防止null在Internet Explorer中显示?

[英]How to keep null from displaying in internet explorer?

The following is a section of my php page where I am displaying a variable based on weather or not it has a value. 以下是我的php页面的一部分,我在其中显示基于天气的变量或没有变量的值。 This works fine in Firefox and Chrome but in internet explorer "null" is being displayed when the variables have no value rather than just being blank like in FF or Chrome. 这在Firefox和Chrome中工作正常,但在Internet Explorer中,当变量没有值而不是像FF或Chrome这样只是空白时,将显示“ null”。 Is there a way to fix this? 有没有办法解决这个问题?

<tr>
 <td>Track</td>
 <td><?php echo $trackResult. '&acute;<br/>';
    if($trackResultOne != NULL){ echo $trackResultOne."&acute;<br/>";}
    if($trackResultTwo != NULL){ echo $trackResultTwo."&acute;";}
    ?></td>
</tr>

Unfortunatelly, you will need to use the ELSE part of the IF to retrieve a blank (''), IE converts automatically the real null into the string 'null'. 可惜的是,你将需要使用IF的ELSE部分检索空白(“”),IE会自动转换的真正零到字符串“空”。

Regards, 问候,

Pablo 巴勃罗

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

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