简体   繁体   English

Firefox在变量上显示php strlen函数的值不正确

[英]Firefox displays incorrect value for php strlen function on variable

I have a variable that I am calculating the length of and in all browsers except FF (IE, Chrome, Safari) the value is 0. 我有一个变量在计算长度,并且在所有浏览器中,除FF(IE,Chrome,Safari)外,其值为0。

However in FF, the value is 65 (see screenshot - value beneath photograph) 但是,在FF中,值为65(请参见屏幕截图-图片下方的值)

screenshot 屏幕截图

Link to site page 链接到网站页面

I have cleared my cache with cc cleaner and using the clear cache option in FF itself. 我已经用cc清除程序清除了缓存,并在FF本身中使用了clear cache选项。

The code I am using wordpress and the code to display the strlen value is:- 我正在使用wordpress的代码和显示strlen值的代码是:-

<? $liurl =  get('ksl_linkedin'); 
$liurl = trim($liurl," ");
echo strlen($liurl);
?>

Any help would be greatly appreciated. 任何帮助将不胜感激。

Thanks 谢谢

Jonathan 乔纳森

The result of a PHP function has nothing to do with the browser - it's calculated before the data gets to the browser. PHP函数的结果与浏览器无关-它是在数据到达浏览器之前计算的。 (for what it's worth, I get "0" with Firefox as well.) (对于它的价值,我在Firefox上也得到“ 0”。)

The only scenario where the browser could play a role is when the data is input by the user some way, or enters the script through a GET or POST variable. 浏览器可以发挥作用的唯一情况是用户以某种方式输入数据,或者通过GET或POST变量输入脚本。

My suspicion is that your get() function returns different values, maybe depending on whether you're logged into Wordpress or not. 我怀疑您的get()函数会返回不同的值,这可能取决于您是否已登录Wordpress。

What does the function do? 该功能做什么?

Can you show us an example link? 您能给我们看一个示例链接吗?

I bet it has nothing to do with Firefox. 我敢打赌它与Firefox无关。 PHP is executed at the server side, so it is not interacting with the browser. PHP在服务器端执行,因此它不与浏览器交互。 See also How does PHP work . 另请参见PHP如何工作

What is get() doing? get()在做什么? Probably this the source of the problem. 这可能是问题的根源。

Btw it shows 0 with Firefox 3.6. 顺便说一句,在Firefox 3.6中显示为0 on a Mac. 在Mac上。

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

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