AS3使用一个简单的PHP脚本从服务器获取时间/日期

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AS3使用一个简单的PHP脚本从服务器获取时间/日期相关的知识,希望对你有一定的参考价值。

  1. // AS3 code loads the contents of getDate.php
  2.  
  3. var ldr:URLLoader = new URLLoader()
  4. ldr.load(new URLRequest("http://www.YOUR-URL.com/getDate.php"))
  5. ldr.addEventListener(Event.COMPLETE, onLoaded)
  6. function onLoaded(evt:Event){
  7. trace(ldr.data)
  8. }
  9.  
  10. // getDate.php sits on a server you can access
  11. // and simply outputs the date - the (j) tells it to output the date as a number
  12. // check http://uk.php.net/manual/en/function.date.php for more options on the output
  13. // script contents below (without the comment slashes of course):
  14.  
  15. //<?php
  16. //print "&serverDate=".date(j);
  17. //?>

以上是关于AS3使用一个简单的PHP脚本从服务器获取时间/日期的主要内容,如果未能解决你的问题,请参考以下文章