PHP和Javascript之间的兼容性问题. [英] Compatibility issues between PHP and Javascript.

查看:123
本文介绍了PHP和Javascript之间的兼容性问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我........

当我将变量从JavaScript传递到另一页中的PHP函数时,我得到的是字符串,而不是值.我的表单中有一个日期字段.当我将其传递为$ startdate而不是日期值时,我将该值作为startdate.


在此先感谢..

Please help me........

When i pass a variable from JavaScript to a PHP function in another page, i am getting the string as it is instead of the value. I have a date field in my form. When i pass it as $startdate, instead of date value,I get the value as startdate.


Thanks in advance..

推荐答案

startdate,而不是日期值,我得到的值是startdate.


预先感谢.
startdate, instead of date value,I get the value as startdate.


Thanks in advance..


看看此php帮助页面 [ ^ ]在其中说明了如何从字符串转换为日期.

希望这对您有帮助!
Take a look at this php help page[^] in which explains you how to cast from a string to a date.

Hope this helps!


我会说,PHP和Javascript无关,它们可能会出现任何兼容性问题.这些是完全正交的问题:PHP仅在服务器端有效,而Javascript…我只是在谈论客户端.

PHP可以生成和HTTP响应,包括Javascript文本.就这样.从功能上讲,它们永远不会拦截-完全没有兼容性问题.

您实际上并没有将变量从Javascript传递给PHP.您只能通过常规格式的Ajax发出HTTP请求. PHP获取HTTP请求数据,该数据始终是一些字符串.您的PHP应用程序如何使用这些字符串是一个问题.如果这是数据,则可以对其进行相应的解析.

—SA
I would say, PHP and Javascript has nothing do to together which can present any compatibility issues. These are perfectly orthogonal matters: PHP works only on server side, and Javascript… I thing you''re talking about client-side only.

PHP can generate and HTTP response, including Javascript text. That''s all. Functionally, they never intercept — no compatibility issues whatsoever.

You do not actually pass a variable from Javascript to PHP. You only make a HTTP request, via Ajax of a regular form. PHP gets HTTP request data which is always some strings. It''s a matter of your PHP application how to use these strings. If this is data, it can be parsed accordingly.

—SA


这篇关于PHP和Javascript之间的兼容性问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆