php通过amf 与flex 通信,我调试发现,只要有date()函数,flex返回就报错

WBOY
Release: 2016-06-23 14:00:36
Original
928 people have browsed it

a.php

<?phpclass edit_img{   function gmtime()   {    $temp = date('Z');    return $temp;   }
Copy after login

}
?>
这个php通过 amf 与flex 通信,我调试发现,只要有date()函数,flex返回就报错。

amf是2.1.1版,反复想不通这个问题

a.php
<?phpclass edit_img{   function gmtime()   {    $temp = time(); //这样就正常    return $temp;   }
Copy after login

}
?>


回复讨论(解决方案)

错误信息是什么?

错误信息是什么?

Flex 提示错误信息:Channel disconnected before an acknowledgement was received 。

目前的调试,flex都报这一个错误

估计是没有指定时区,导致使用date()函数的warning。
php中屏蔽warning级错误,或者在php中加上 date_default_timezone_set("Asia/Shanghai");

date('Z') 返回不超过5位的正负数字
time 返回 10 位的数字

你的 gmtime 显然应返回一个格林威治时间的秒数
如果 gmtime 方法的调用者做了合法性检查,显然就会因错误而终止程序了

这一点你可以这样验证

function gmtime()   {    return 100;   }
Copy after login
Copy after login

date('Z') 返回不超过5位的正负数字
time 返回 10 位的数字

你的 gmtime 显然应返回一个格林威治时间的秒数
如果 gmtime 方法的调用者做了合法性检查,显然就会因错误而终止程序了

这一点你可以这样验证

function gmtime()   {    return 100;   }
Copy after login
Copy after login

感谢版主,在这里问了很多问题都有你的回复。问题已经解决

估计是没有指定时区,导致使用date()函数的warning。
php中屏蔽warning级错误,或者在php中加上 date_default_timezone_set("Asia/Shanghai");

加上就好了,真是奇怪,我测试的时候,即使date('s'); 也返回错误。根本没想到这里。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!